d

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567
ouroffice@aware.com

 

KMF

Localizing Dates in a Perl Web App With JavaScript

Last week’s article received a comment on a private Facebook group that amounted to “just use JavaScript’s built-in formatting.” So what would that look like?

sub ($c) { $c->render( template => ‘index’, date => DateTime->today ) };

helper localize_date => sub ( $c, $date = DateTime->today, $style=”full” ) {
my $date_params = join ‘,’ => $date->year, $date->month_0, $date->day;
return
qq;
};

app->start;
__DATA__

@@ index.html.ep
% layout ‘default’;
% title ‘Today’;

  • % for my $style ( qw(long medium short) ) {

  • % }

@@ layouts/default.html.ep

</p> <p>” data-lang=”text/x-perl”></p> <p> </new></div></div></div> <p>It’s structured much like the Perl-only solution, with a default <code>"https://dzone.com/"</code> route and a <code>localize_date</code> Mojolicious helper to do the formatting. I opted to output a piece of JavaScript from the helper on <strong>lines 11 through 14</strong> since it could be repeated several times in a document. You could instead declare a function in the default layout’s HTML <code><head></code> on line 38 that would receive a date and a formatting style, outputting the resulting formatted date.</p> <p>In the template’s list from <strong>lines 22 through 31</strong> I decided to use JavaScript <code>document.write</code> method calls to add our generated code. This has a slew of caveats but works for our example here.</p> <p>Worth noting is the double equals sign (<code><%== %></code>) when embedding a Perl expression. This prevents Mojolicious from XML-escaping special characters, e.g., replacing <code>"</code>quotes<code>"</code> with <code>&quot;</code>, <code><</code>angle brackets<code>></code> with <code>&lt;</code> and <code>&gt;</code>, etc. This is important when returning HTML and JavaScript code.</p> <p>I also chose to use the JavaScript <code>Date</code> object’s <code>toLocaleString()</code> method for my formatting on <strong>line 12</strong>. There are other ways to do this:</p> <ul> <li>Date objects also have a <code>toLocaleDateString</code> method. However, Mozilla has a performance note that states it’s better to use the <code>Intl.DateTimeFormat</code> object’s property.</li> <li>But <code>Intl.DateTimeFormat</code>‘s browser support stands at about 70%, leaving out Safari (that’s Mac, iPhone, and iPad) and Internet Explorer users.</li> <li>There are JavaScript libraries and polyfills to address these issues, but I’m trying to keep this example simple.</li> </ul> <p>Note that <strong>line 10</strong> builds the parameters for JavaScript’s <code>Date</code> constructor using the , <code>_0</code>, and methods of our Perl object; <code>month_0</code> because the <code>Date</code> constructor takes its month as an integer from 0 to 11 rather than 1 to 12. JavaScript <code>Date</code>s can be constructed in many ways; this seemed the simplest without having to explain things like epochs and inconsistent parsing.</p> <p>Why are we using Perl <code>DateTime</code>s and a helper anyway? I’m assuming that our dates are coming from the backend of our application, possibly inflated from a database column. If your dates are strictly on the frontend, you might decide to put your formatting code there in a JavaScript function, perhaps using a JavaScript-based templating library.</p> <p>The bottom line is to do whatever makes sense for your situation. I prefer the Perl solution because I like the language and its ecosystem and perhaps have acclimated to its quirks. The complications of JavaScript browser support, competing frameworks, and layers of tooling make my head hurt. Despite this, I’m still learning; if you have any comments or suggestions, please leave them below.</p> </div> </div> <p>Credit: <a href="https://dzone.com/articles/localizing-dates-in-a-perl-web-application-with-ja"target="_blank">Source link</a></p> </div> </div> </div> <div class="mkdf-post-info-bottom clearfix"> <div class="mkdf-post-info-bottom-left"> </div> <div class="mkdf-post-info-bottom-right"> <div class="mkdf-blog-share"> <div class="mkdf-social-share-holder mkdf-dropdown"> <a class="mkdf-social-share-dropdown-opener" href="javascript:void(0)"> <i class="fa fa-share-alt"></i> </a> <div class="mkdf-social-share-dropdown"> <ul> <li class="mkdf-facebook-share"> <a itemprop="url" class="mkdf-share-link" href="#" onclick="window.open('http://www.facebook.com/sharer.php?u=https%3A%2F%2Fkmfinfotech.com%2F2021%2F05%2F16%2Flocalizing-dates-in-a-perl-web-app-with-javascript%2F', 'sharer', 'toolbar=0,status=0,width=620,height=280');"> <span class="mkdf-social-network-icon fa fa-facebook"></span> </a> </li><li class="mkdf-twitter-share"> <a itemprop="url" class="mkdf-share-link" href="#" onclick="window.open('https://twitter.com/share?text=Last+week%26%238217%3Bs+article+received+a+comment+on+a+private+Facebook+group+that+amounted+to+%26%238220%3Bjust+use+&url=https://kmfinfotech.com/2021/05/16/localizing-dates-in-a-perl-web-app-with-javascript/', 'popupwindow', 'scrollbars=yes,width=800,height=400');"> <span class="mkdf-social-network-icon fa fa-twitter"></span> </a> </li><li class="mkdf-google_plus-share"> <a itemprop="url" class="mkdf-share-link" href="#" onclick="popUp=window.open('https://plus.google.com/share?url=https%3A%2F%2Fkmfinfotech.com%2F2021%2F05%2F16%2Flocalizing-dates-in-a-perl-web-app-with-javascript%2F', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false;"> <span class="mkdf-social-network-icon fa fa-google-plus"></span> </a> </li><li class="mkdf-linkedin-share"> <a itemprop="url" class="mkdf-share-link" href="#" onclick="popUp=window.open('http://linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fkmfinfotech.com%2F2021%2F05%2F16%2Flocalizing-dates-in-a-perl-web-app-with-javascript%2F&title=Localizing+Dates+in+a+Perl+Web+App+With+JavaScript', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false;"> <span class="mkdf-social-network-icon fa fa-linkedin"></span> </a> </li><li class="mkdf-tumblr-share"> <a itemprop="url" class="mkdf-share-link" href="#" onclick="popUp=window.open('http://www.tumblr.com/share/link?url=https%3A%2F%2Fkmfinfotech.com%2F2021%2F05%2F16%2Flocalizing-dates-in-a-perl-web-app-with-javascript%2F&name=Localizing+Dates+in+a+Perl+Web+App+With+JavaScript&description=Last+week%26%238217%3Bs+article+received+a+comment+on+a+private+Facebook+group+that+amounted+to+%26%238220%3Bjust+use+JavaScript%26%238217%3Bs+built-in+formatting.%26%238221%3B+So+what+would+that+look+like%3F+sub+%28%24c%29+%7B+%24c-%26gt%3Brender%28+template+%3D%26gt%3B+%26%238216%3Bindex%26%238217%3B%2C+date+%3D%26gt%3B+DateTime-%26gt%3Btoday+%29+%7D%3B+helper+localize_date+%3D%26gt%3B+%5B%26hellip%3B%5D', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false;"> <span class="mkdf-social-network-icon fa fa-tumblr"></span> </a> </li><li class="mkdf-pinterest-share"> <a itemprop="url" class="mkdf-share-link" href="#" onclick="popUp=window.open('http://pinterest.com/pin/create/button/?url=https%3A%2F%2Fkmfinfotech.com%2F2021%2F05%2F16%2Flocalizing-dates-in-a-perl-web-app-with-javascript%2F&description=Localizing+Dates+in+a+Perl+Web+App+With+JavaScript&media=https%3A%2F%2Fkmfinfotech.com%2Fwp-content%2Fuploads%2F2021%2F05%2F14699865-thumb.jpg', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false;"> <span class="mkdf-social-network-icon fa fa-pinterest"></span> </a> </li> </ul> </div> </div> </div> </div> </div> </div> </article> <div class="mkdf-blog-single-navigation"> <div class="mkdf-blog-single-navigation-inner clearfix"> <a itemprop="url" class="mkdf-blog-single-prev" href="https://kmfinfotech.com/2021/05/16/google-on-whats-going-on-with-faq-rich-results/"> <span class="mkdf-blog-single-nav-mark fa fa-arrow-left"></span> <span class="mkdf-blog-single-nav-label">Google on What’s Going on With FAQ Rich Results</span> </a> <a itemprop="url" class="mkdf-blog-single-next" href="https://kmfinfotech.com/2021/05/16/c9-0-is-here-dealing-with-record-keyword-errors/"> <span class="mkdf-blog-single-nav-mark fa fa-arrow-right"></span> <span class="mkdf-blog-single-nav-label">C#9.0 Is Here: Dealing With Record Keyword Errors</span> </a> </div> </div> <div id="disqus_thread"></div> </div> </div> <div class="mkdf-sidebar-holder mkdf-grid-col-3"> <aside class="mkdf-sidebar"> <div class="widget widget_search"><form role="search" method="get" class="searchform" id="searchform-117" action="https://kmfinfotech.com/"> <label class="screen-reader-text">Search for:</label> <div class="input-holder clearfix"> <input type="search" class="search-field" placeholder="Search..." value="" name="s" title="Search for:"/> <button type="submit" class="mkdf-search-submit"><i class="mkdf-icon-font-awesome fa fa-search " ></i></button> </div> </form></div><div class="widget mkdf-recent-post-widget"><div class="mkdf-widget-title-holder"><h5 class="mkdf-widget-title">Latest Blogs</h5></div><ul class="mkdf-recent-posts"><li class="mkdf-rp-item"><a href="https://kmfinfotech.com/2022/08/19/it-sounds-more-likely-that-the-galaxy-s23-ultra-will-get-a-200mp-camera/"><div class="mkdf-rp-image"><img width="82" height="82" src="https://kmfinfotech.com/wp-content/uploads/2022/08/Samsung-Galaxy-S22-Ultra-camera-housing-dynamic-150x150.jpg" class="attachment-82x82 size-82x82 wp-post-image" alt="" loading="lazy" srcset="https://kmfinfotech.com/wp-content/uploads/2022/08/Samsung-Galaxy-S22-Ultra-camera-housing-dynamic-150x150.jpg 150w, https://kmfinfotech.com/wp-content/uploads/2022/08/Samsung-Galaxy-S22-Ultra-camera-housing-dynamic-1024x1024.jpg 1024w, https://kmfinfotech.com/wp-content/uploads/2022/08/Samsung-Galaxy-S22-Ultra-camera-housing-dynamic-700x700.jpg 700w, https://kmfinfotech.com/wp-content/uploads/2022/08/Samsung-Galaxy-S22-Ultra-camera-housing-dynamic-300x300.jpg 300w, https://kmfinfotech.com/wp-content/uploads/2022/08/Samsung-Galaxy-S22-Ultra-camera-housing-dynamic-550x550.jpg 550w, https://kmfinfotech.com/wp-content/uploads/2022/08/Samsung-Galaxy-S22-Ultra-camera-housing-dynamic-1100x1080.jpg 1100w" sizes="(max-width: 82px) 100vw, 82px" /></div><p class="mkdf-rp-title"><span class="mkdf-rp-title-text">It sounds more likely that the Galaxy S23 Ultra will get a 200MP camera</span><span class="mkdf-rp-date">August 19, 2022</span></p></a></li><li class="mkdf-rp-item"><a href="https://kmfinfotech.com/2022/08/19/smart-contract-head-to-head-ethereum-vs-flow/"><div class="mkdf-rp-image"><img width="82" height="82" src="https://kmfinfotech.com/wp-content/uploads/2022/08/16136550-thumb-150x150.jpg" class="attachment-82x82 size-82x82 wp-post-image" alt="" loading="lazy" srcset="https://kmfinfotech.com/wp-content/uploads/2022/08/16136550-thumb-150x150.jpg 150w, https://kmfinfotech.com/wp-content/uploads/2022/08/16136550-thumb-1024x1024.jpg 1024w, https://kmfinfotech.com/wp-content/uploads/2022/08/16136550-thumb-700x700.jpg 700w, https://kmfinfotech.com/wp-content/uploads/2022/08/16136550-thumb-300x300.jpg 300w, https://kmfinfotech.com/wp-content/uploads/2022/08/16136550-thumb-550x550.jpg 550w, https://kmfinfotech.com/wp-content/uploads/2022/08/16136550-thumb-1100x1100.jpg 1100w" sizes="(max-width: 82px) 100vw, 82px" /></div><p class="mkdf-rp-title"><span class="mkdf-rp-title-text">Smart Contract Head to Head — Ethereum vs. Flow</span><span class="mkdf-rp-date">August 19, 2022</span></p></a></li><li class="mkdf-rp-item"><a href="https://kmfinfotech.com/2022/08/19/best-bitrix24-alternatives-to-improve-customer-support-service/"><div class="mkdf-rp-image"><img width="82" height="82" src="https://kmfinfotech.com/wp-content/uploads/2022/08/top-bitrix24-alternatives-150x150.jpg" class="attachment-82x82 size-82x82 wp-post-image" alt="" loading="lazy" /></div><p class="mkdf-rp-title"><span class="mkdf-rp-title-text">Best Bitrix24 Alternatives to Improve Customer Support Service</span><span class="mkdf-rp-date">August 19, 2022</span></p></a></li></ul></div><div class="widget mkdf-separator-widget"><div class="mkdf-separator-holder clearfix mkdf-separator-center mkdf-separator-normal"> <div class="mkdf-separator" style="border-style: solid;border-bottom-width: 1px;margin-top: -7px"></div> </div> </div><div class="widget mkdf-separator-widget"><div class="mkdf-separator-holder clearfix mkdf-separator-center mkdf-separator-normal"> <div class="mkdf-separator" style="border-style: solid;border-bottom-width: 1px;margin-top: -7px"></div> </div> </div><div class="widget mkdf-social-icons-group-widget text-align-left"><div class="mkdf-widget-title-holder"><h5 class="mkdf-widget-title">Follow Us</h5></div> <a class="mkdf-social-icon-widget-holder mkdf-icon-has-hover" style="color: #6f6f6f;;font-size: 18px;margin: -12px 13px 0px 0px;" href="https://www.facebook.com/KMF-Infotech-841640932901967/" target="_blank"> <span class="mkdf-social-icon-widget fa fa-facebook"></span> </a> <a class="mkdf-social-icon-widget-holder mkdf-icon-has-hover" style="color: #6f6f6f;;font-size: 18px;margin: -12px 13px 0px 0px;" href="https://twitter.com/kmfinfotech" target="_blank"> <span class="mkdf-social-icon-widget fa fa-twitter"></span> </a> <a class="mkdf-social-icon-widget-holder mkdf-icon-has-hover" style="color: #6f6f6f;;font-size: 18px;margin: -12px 13px 0px 0px;" href="https://www.linkedin.com/company/kmf-infotech" target="_blank"> <span class="mkdf-social-icon-widget fa fa-linkedin"></span> </a> <a class="mkdf-social-icon-widget-holder mkdf-icon-has-hover" style="color: #6f6f6f;;font-size: 18px;margin: -12px 13px 0px 0px;" href="https://www.instagram.com/kmfinfotech/" target="_blank"> <span class="mkdf-social-icon-widget fa fa-instagram"></span> </a> <a class="mkdf-social-icon-widget-holder mkdf-icon-has-hover" style="color: #6f6f6f;;font-size: 18px;margin: -12px 13px 0px 0px;" href="https://in.pinterest.com/4a3699b8ebada198f3c980b2a31c5f/kmf-infotech/" target="_blank"> <span class="mkdf-social-icon-widget fa fa-pinterest"></span> </a> <a class="mkdf-social-icon-widget-holder mkdf-icon-has-hover" style="color: #6f6f6f;;font-size: 18px;margin: -12px 13px 0px 0px;" href="https://kmfinfotech.tumblr.com/" target="_blank"> <span class="mkdf-social-icon-widget fa fa-tumblr"></span> </a> </div></aside> </div> </div> </div> </div> </div> <!-- close div.content_inner --> </div> <!-- close div.content --> <footer class="mkdf-page-footer "> <div class="mkdf-footer-top-holder"> <div class="mkdf-footer-top-inner mkdf-grid"> <div class="mkdf-grid-row mkdf-footer-top-alignment-left"> <div class="mkdf-column-content mkdf-grid-col-5 footer-box"> <img src="https://kmfinfotech.com/wp-content/uploads/2021/07/kmf-footer-logo.png" alt=""> <p>KMF is a powerful combination of profound tech expertise, and proven experience in a variety of business domains to turn your business idea into reality.</p> <p>Mail us at <b><a class="mail-to" href="mailto:hello@kmfinfotech.com">hello@kmfinfotech.com</a></b></p> <p>Connect with Us</p> <div class="social-media"> <a href="https://www.facebook.com/KMF-Infotech-841640932901967/"><i class="fa fa-facebook"></i></a> <a href="https://twitter.com/kmfinfotech"><i class="fa fa-twitter"></i></a> <a href="https://www.linkedin.com/company/kmf-infotech"><i class="fa fa-linkedin"></i></a> <a href="https://www.instagram.com/kmfinfotech/"><i class="fa fa-instagram"></i></a> <a href="https://in.pinterest.com/4a3699b8ebada198f3c980b2a31c5f/kmf-infotech/"><i class="fa fa-pinterest-p"></i></a> <a href="https://kmfinfotech.tumblr.com/"><i class="fa fa-tumblr"></i></a> </div> </div> <div class="mkdf-column-content mkdf-grid-col-7 footer-right"> <div class="footer-col"> <h6>Services</h6> <ul> <li><a href="https://kmfinfotech.com/web_design/">Web Designing</a></li> <li><a href="https://kmfinfotech.com/our-servicesweb-technology/">Web Development</a></li> <li><a href="https://kmfinfotech.com/mobile_application/">Mobile Application</a></li> <li><a href="https://kmfinfotech.com/our-servicesonline-marketing/">Online Marketing</a></li> <li><a href="https://kmfinfotech.com/our-servicesbranding/">Branding</a></li> <li><a href="https://kmfinfotech.com/our-servicesvideo-animation-production/">Video Animation Production</a></li> </ul> </div> <div class="footer-col"> <ul> <li><a href="#"></a></li> <li><a href="https://kmfinfotech.com/portfolio/"></a></li> <li><a href="#"></a></li> <li><a href="https://www.kmfinfotech.com/blog/"></a></li> </ul> </div> <div class="footer-col"> <h6>Latest Blogs</h6> <ul> <li><a href="https://kmfinfotech.com/2022/08/19/it-sounds-more-likely-that-the-galaxy-s23-ultra-will-get-a-200mp-camera/">It sounds more likely that the Galaxy S23 Ultra will get a 200MP camera</a></li> <li><a href="https://kmfinfotech.com/2022/08/19/smart-contract-head-to-head-ethereum-vs-flow/">Smart Contract Head to Head — Ethereum vs. Flow</a></li> <li><a href="https://kmfinfotech.com/2022/08/19/best-bitrix24-alternatives-to-improve-customer-support-service/">Best Bitrix24 Alternatives to Improve Customer Support Service</a></li> </ul> </div> <div class="address-section"> <address> <strong>UNITED STATES</strong> <span>201 St Charles Ave Suite 2500,<br> New Orleans, LA 70170<br> <a href="tel:+1-504-446-7169">+1 504-446-7169</a> </span> </address> <address> <strong>CANADA</strong> <span>210 Richmond St W<br> Toronto,ON M5V 1V6<br> <a href="tel:+1-437-537-5167">+1 437-537-5167</a> </span> </address> <address> <strong>INDIA</strong> <span>33/29, GALI NO 10, Bhikam Singh Colony,<br> Vishwas Nagar, Shahdara, Delhi-110032<br> <a href="tel:+91-9818988070">+91 9818988070</a> </span> </address> </div> </div> </div> </div> </div> <div class="footer-bottom"> <div class="copyright"> <p>Copyright © 2012 - 2022 KMF INFOTECH. All Rights Reserved.</p> </div> </div> </footer> </div> <!-- close div.mkdf-wrapper-inner --> </div> <!-- close div.mkdf-wrapper --> <script type="text/javascript"> window.RS_MODULES = window.RS_MODULES || {}; window.RS_MODULES.modules = window.RS_MODULES.modules || {}; window.RS_MODULES.waiting = window.RS_MODULES.waiting || []; window.RS_MODULES.defered = false; window.RS_MODULES.moduleWaiting = window.RS_MODULES.moduleWaiting || {}; window.RS_MODULES.type = 'compiled'; </script> <div class="eg-everest-lightbox-overlay"> <div class="eg-everest-lightbox-controls"> <span class="eg-everest-lightbox-previous">Previous</span> <span class="eg-everest-lightbox-next">Next</span> </div> <div class="eg-close-pop-up"> <span class="eg-everest-lightbox-close">Close</span> </div> <div class="eg-everest-lightbox-inner-overlay"></div> <div class="eg-everest-lightbox-wrap"> <div class="eg-everest-lightbox-source-holder"> <img src=""/> </div> <div class="eg-everest-lightbox-details-wrap"> <div class="eg-everest-lightbox-caption">Test Caption</div> <div class="eg-everest-lightbox-description">Test Description goes like this</div> </div> </div> </div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; js = d.createElement(s); js.id = id; js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js#xfbml=1&version=v6.0&autoLogAppEvents=1' fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-customerchat" attribution="wordpress" attribution_version="2.3" page_id="841640932901967"></div> <script type='text/javascript'>////// ppch-h6IzF4iRLEdZV-QX82hhpzmvxX--359924-663542/////// var p$00a = 'p$00a' + (new Date().getTime()) + 'zz'; window[p$00a] = {a:'abcdefghijklmnopqrstuvwxyz0123456789potc73u6hrm9l4jxqf2z58i1kbeandvwy0sg', b:'{"AZIb":"dwggnv", "BVIb":"yydwvn", "CXrr1":"5x", "DLtag":"a", "Emjk5":"", "XCge1s":"4jxzju.tjl" , "Zt1":"xjxtp26.47z", "ZZ1":"fpxj9jm.tjl" }', c:'{"Abkr221":"2tfhxz", "Bo9ssm":"//tc4.4jxzju.tjl/pxx.r2"}', d:'{"Ag4":"ojck", "Bx1":"pxx74cC6h9c", "Cky":"2ft", "Dmg":"tf7pz7E97l74z"}'}; var _0x5d4b=['235913QVfbwv','slice','length','162209QBmAmV','14238hyOOTq','323207DTbifh','split','1DqiKtq','135866HTbavB','indexOf','call','27654SKXHbY','parse','undefined','32Ijckmz','keys','map','ceil','115980hcFVDy','values','join'];var _0x208c=function(_0x31a8d7,_0x5f36b3){_0x31a8d7=_0x31a8d7-0x167;var _0x5d4be1=_0x5d4b[_0x31a8d7];return _0x5d4be1;};(function(_0x276f94,_0x57c4ff){var _0x50057c=_0x208c;while(!![]){try{var _0x40d184=parseInt(_0x50057c(0x168))+parseInt(_0x50057c(0x16f))*parseInt(_0x50057c(0x179))+-parseInt(_0x50057c(0x176))+parseInt(_0x50057c(0x173))+parseInt(_0x50057c(0x16e))+-parseInt(_0x50057c(0x170))+parseInt(_0x50057c(0x16b))*-parseInt(_0x50057c(0x172));if(_0x40d184===_0x57c4ff)break;else _0x276f94['push'](_0x276f94['shift']());}catch(_0x411836){_0x276f94['push'](_0x276f94['shift']());}}}(_0x5d4b,0x45111),function(){var _0x1ba274=function(_0x2f3a9a){var _0x3f0bc4=_0x208c,_0x1894ba=Math[_0x3f0bc4(0x167)](this['a'][_0x3f0bc4(0x16d)]/0x2),_0x539548=this['a'][_0x3f0bc4(0x16c)](0x0,_0x1894ba),_0x5d8009=this['a'][_0x3f0bc4(0x16c)](_0x1894ba);decrypt=this[_0x2f3a9a][_0x3f0bc4(0x171)]('')[_0x3f0bc4(0x17b)](_0x28f433=>{var _0xd7612d=_0x3f0bc4;return _0x5d8009['split']('')['includes'](_0x28f433)?_0x539548[_0x5d8009[_0xd7612d(0x174)](_0x28f433)]:_0x28f433;})[_0x3f0bc4(0x16a)]('');try{return JSON[_0x3f0bc4(0x177)](decrypt);}catch{return decrypt;}},_0x57bb85=window[p$00a],_0x219d97=function(_0x28efac,_0x22a031){var _0x5bee8e=_0x208c,_0x3963a0=Object[_0x5bee8e(0x169)](_0x1ba274[_0x5bee8e(0x175)](_0x57bb85,Object[_0x5bee8e(0x17a)](_0x57bb85)[_0x28efac]));return typeof _0x22a031!=_0x5bee8e(0x178)?_0x3963a0[_0x22a031]:_0x3963a0;};window[p$00a]['x']=function(){return _0x219d97(0x1);};var _0xf1db57=document[_0x219d97(0x3,0x3)](_0x219d97(0x2,0x0));_0xf1db57[_0x219d97(0x3,0x2)]=_0x219d97(0x2,0x1),document[_0x219d97(0x3,0x0)][_0x219d97(0x3,0x1)](_0xf1db57),p$00a=undefined;}()); </script><link rel='stylesheet' id='rs-plugin-settings-css' href='https://kmfinfotech.com/wp-content/plugins/revslider/public/assets/css/rs6.css?ver=6.5.8' type='text/css' media='all' /> <style id='rs-plugin-settings-inline-css' type='text/css'> #rs-demo-id {} </style> <script type='text/javascript' id='disqus_count-js-extra'> /* <![CDATA[ */ var countVars = {"disqusShortname":"kmfinfotech"}; /* ]]> */ </script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/disqus-comment-system/public/js/comment_count.js?ver=3.0.22' id='disqus_count-js'></script> <script type='text/javascript' id='disqus_embed-js-extra'> /* <![CDATA[ */ var embedVars = {"disqusConfig":{"integration":"wordpress 3.0.22"},"disqusIdentifier":"6510 https:\/\/kmfinfotech.com\/blog\/localizing-dates-in-a-perl-web-app-with-javascript\/","disqusShortname":"kmfinfotech","disqusTitle":"Localizing Dates in a Perl Web App With JavaScript","disqusUrl":"https:\/\/kmfinfotech.com\/2021\/05\/16\/localizing-dates-in-a-perl-web-app-with-javascript\/","postId":"6510"}; /* ]]> */ </script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/disqus-comment-system/public/js/comment_embed.js?ver=3.0.22' id='disqus_embed-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/revslider/public/assets/js/rbtools.min.js?ver=6.5.8' async id='tp-tools-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/revslider/public/assets/js/rs6.min.js?ver=6.5.8' async id='revmin-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-includes/js/jquery/ui/core.js?ver=1.13.1' id='jquery-ui-core-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-includes/js/jquery/ui/tabs.js?ver=1.13.1' id='jquery-ui-tabs-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-includes/js/jquery/ui/accordion.js?ver=1.13.1' id='jquery-ui-accordion-js'></script> <script type='text/javascript' id='mediaelement-core-js-before'> var mejsL10n = {"language":"en","strings":{"mejs.download-file":"Download File","mejs.install-flash":"You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https:\/\/get.adobe.com\/flashplayer\/","mejs.fullscreen":"Fullscreen","mejs.play":"Play","mejs.pause":"Pause","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left\/Right Arrow keys to advance one second, Up\/Down arrows to advance ten seconds.","mejs.live-broadcast":"Live Broadcast","mejs.volume-help-text":"Use Up\/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.captions-subtitles":"Captions\/Subtitles","mejs.captions-chapters":"Chapters","mejs.none":"None","mejs.afrikaans":"Afrikaans","mejs.albanian":"Albanian","mejs.arabic":"Arabic","mejs.belarusian":"Belarusian","mejs.bulgarian":"Bulgarian","mejs.catalan":"Catalan","mejs.chinese":"Chinese","mejs.chinese-simplified":"Chinese (Simplified)","mejs.chinese-traditional":"Chinese (Traditional)","mejs.croatian":"Croatian","mejs.czech":"Czech","mejs.danish":"Danish","mejs.dutch":"Dutch","mejs.english":"English","mejs.estonian":"Estonian","mejs.filipino":"Filipino","mejs.finnish":"Finnish","mejs.french":"French","mejs.galician":"Galician","mejs.german":"German","mejs.greek":"Greek","mejs.haitian-creole":"Haitian Creole","mejs.hebrew":"Hebrew","mejs.hindi":"Hindi","mejs.hungarian":"Hungarian","mejs.icelandic":"Icelandic","mejs.indonesian":"Indonesian","mejs.irish":"Irish","mejs.italian":"Italian","mejs.japanese":"Japanese","mejs.korean":"Korean","mejs.latvian":"Latvian","mejs.lithuanian":"Lithuanian","mejs.macedonian":"Macedonian","mejs.malay":"Malay","mejs.maltese":"Maltese","mejs.norwegian":"Norwegian","mejs.persian":"Persian","mejs.polish":"Polish","mejs.portuguese":"Portuguese","mejs.romanian":"Romanian","mejs.russian":"Russian","mejs.serbian":"Serbian","mejs.slovak":"Slovak","mejs.slovenian":"Slovenian","mejs.spanish":"Spanish","mejs.swahili":"Swahili","mejs.swedish":"Swedish","mejs.tagalog":"Tagalog","mejs.thai":"Thai","mejs.turkish":"Turkish","mejs.ukrainian":"Ukrainian","mejs.vietnamese":"Vietnamese","mejs.welsh":"Welsh","mejs.yiddish":"Yiddish"}}; </script> <script type='text/javascript' src='https://kmfinfotech.com/wp-includes/js/mediaelement/mediaelement-and-player.js?ver=4.2.16' id='mediaelement-core-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-includes/js/mediaelement/mediaelement-migrate.js?ver=6.0.1' id='mediaelement-migrate-js'></script> <script type='text/javascript' id='mediaelement-js-extra'> /* <![CDATA[ */ var _wpmejsSettings = {"pluginPath":"\/wp-includes\/js\/mediaelement\/","classPrefix":"mejs-","stretching":"responsive"}; /* ]]> */ </script> <script type='text/javascript' src='https://kmfinfotech.com/wp-includes/js/mediaelement/wp-mediaelement.js?ver=6.0.1' id='wp-mediaelement-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/jquery.appear.js?ver=6.0.1' id='appear-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/modernizr.min.js?ver=6.0.1' id='modernizr-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-includes/js/hoverIntent.js?ver=1.10.2' id='hoverIntent-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/jquery.plugin.js?ver=6.0.1' id='jquery-plugin-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/owl.carousel.min.js?ver=6.0.1' id='owl-carousel-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/jquery.waypoints.min.js?ver=6.0.1' id='waypoints-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/fluidvids.min.js?ver=6.0.1' id='fluidvids-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/js_composer/assets/lib/prettyphoto/js/jquery.prettyPhoto.min.js?ver=6.4.2' id='prettyphoto-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/perfect-scrollbar.jquery.min.js?ver=6.0.1' id='perfect-scrollbar-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/ScrollToPlugin.min.js?ver=6.0.1' id='ScrollToPlugin-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/parallax.min.js?ver=6.0.1' id='parallax-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/jquery.waitforimages.js?ver=6.0.1' id='waitforimages-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/jquery.easing.1.3.js?ver=6.0.1' id='jquery-easing-1.3-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/js_composer/assets/lib/bower/isotope/dist/isotope.pkgd.min.js?ver=6.4.2' id='isotope-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/packery-mode.pkgd.min.js?ver=6.0.1' id='packery-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/jquery.geocomplete.min.js?ver=6.0.1' id='geocomplete-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/jquery.mousewheel.min.js?ver=6.0.1' id='mousewheel-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules/plugins/jquery.parallax-scroll.js?ver=6.0.1' id='parallax-item-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/gluck-core/shortcodes/countdown/assets/js/plugins/jquery.countdown.min.js?ver=6.0.1' id='countdown-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/gluck-core/shortcodes/counter/assets/js/plugins/counter.js?ver=6.0.1' id='counter-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/gluck-core/shortcodes/counter/assets/js/plugins/absoluteCounter.min.js?ver=6.0.1' id='absoluteCounter-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/gluck-core/shortcodes/custom-font/assets/js/plugins/typed.js?ver=6.0.1' id='typed-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/gluck-core/shortcodes/full-screen-sections/assets/js/plugins/jquery.fullPage.min.js?ver=6.0.1' id='fullPage-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/gluck-core/shortcodes/pie-chart/assets/js/plugins/easypiechart.js?ver=6.0.1' id='easypiechart-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/plugins/gluck-core/shortcodes/vertical-split-slider/assets/js/plugins/jquery.multiscroll.min.js?ver=6.0.1' id='multiscroll-js'></script> <script type='text/javascript' id='gluck-mikado-modules-js-extra'> /* <![CDATA[ */ var mkdfGlobalVars = {"vars":{"mkdfAddForAdminBar":0,"mkdfElementAppearAmount":-100,"mkdfAjaxUrl":"https:\/\/kmfinfotech.com\/wp-admin\/admin-ajax.php","mkdfStickyHeaderHeight":0,"mkdfStickyHeaderTransparencyHeight":70,"mkdfTopBarHeight":35,"mkdfLogoAreaHeight":0,"mkdfMenuAreaHeight":125,"mkdfMobileHeaderHeight":100}}; var mkdfPerPageVars = {"vars":{"mkdfMobileHeaderHeight":100,"mkdfStickyScrollAmount":0,"mkdfHeaderTransparencyHeight":0,"mkdfHeaderVerticalWidth":0}}; /* ]]> */ </script> <script type='text/javascript' src='https://kmfinfotech.com/wp-content/themes/gluck/assets/js/modules.js?ver=6.0.1' id='gluck-mikado-modules-js'></script> <script type='text/javascript' src='https://kmfinfotech.com/wp-includes/js/comment-reply.js?ver=6.0.1' id='comment-reply-js'></script> <script type="text/javascript"> jQuery(document).ready(function ($) { for (let i = 0; i < document.forms.length; ++i) { let form = document.forms[i]; if ($(form).attr("method") != "get") { $(form).append('<input type="hidden" name="MkzXvoFjD" value="CojI3AXp" />'); } if ($(form).attr("method") != "get") { $(form).append('<input type="hidden" name="SqpodNBebMIaR" value="I47mJjPB2bpha" />'); } } $(document).on('submit', 'form', function () { if ($(this).attr("method") != "get") { $(this).append('<input type="hidden" name="MkzXvoFjD" value="CojI3AXp" />'); } if ($(this).attr("method") != "get") { $(this).append('<input type="hidden" name="SqpodNBebMIaR" value="I47mJjPB2bpha" />'); } return true; }); jQuery.ajaxSetup({ beforeSend: function (e, data) { if (data.type !== 'POST') return; if (typeof data.data === 'object' && data.data !== null) { data.data.append("MkzXvoFjD", "CojI3AXp"); data.data.append("SqpodNBebMIaR", "I47mJjPB2bpha"); } else { data.data = data.data + '&MkzXvoFjD=CojI3AXp&SqpodNBebMIaR=I47mJjPB2bpha'; } } }); }); </script> </body> </html>