<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Template scripts: new Date().toLocaleDateString() not working properly]]></title><description><![CDATA[<p><strong>VERSION: jsreport.exe v.1.10</strong></p>
<p>I have the template and right below the template I'm having few scripts, e.g.</p>
<pre><code>function format_date(d) {
    if (!d) {
        return '';
    }
    var options = { day: '2-digit', month: '2-digit' };
    return (new Date(d)).toLocaleDateString('en-AU', options);
}
</code></pre>
<p>but this is giving me the incorrect locale string:</p>
<blockquote>
<p>Wednesday, February 28, 2018</p>
</blockquote>
<p>If I run exactly the same thing in my chrome browser or in the nodejs, with the full-icu package installed and with correct environment variable (NODE_ICU_DATA) I get:</p>
<blockquote>
<p>'28/02'</p>
</blockquote>
<p>Which is correct.</p>
<p>How can I get the full locale support available for the functions declared in the template? I reckon it's that snapshot of chrome you are packaging... Thanks for any help here.</p>
<p><strong>VERSION: jsreport (node) v.2.1</strong><br />
In this version I'm getting a slightly better result, but still not right as the day should be first</p>
<blockquote>
<p>'02/28'</p>
</blockquote>
]]></description><link>https://forum.jsreport.net/topic/570/template-scripts-new-date-tolocaledatestring-not-working-properly</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 15:43:55 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/570.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Jun 2018 07:06:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Template scripts: new Date().toLocaleDateString() not working properly on Thu, 14 Jun 2018 07:15:56 GMT]]></title><description><![CDATA[<p><strong>VERSION: jsreport.exe v.1.10</strong></p>
<p>I have the template and right below the template I'm having few scripts, e.g.</p>
<pre><code>function format_date(d) {
    if (!d) {
        return '';
    }
    var options = { day: '2-digit', month: '2-digit' };
    return (new Date(d)).toLocaleDateString('en-AU', options);
}
</code></pre>
<p>but this is giving me the incorrect locale string:</p>
<blockquote>
<p>Wednesday, February 28, 2018</p>
</blockquote>
<p>If I run exactly the same thing in my chrome browser or in the nodejs, with the full-icu package installed and with correct environment variable (NODE_ICU_DATA) I get:</p>
<blockquote>
<p>'28/02'</p>
</blockquote>
<p>Which is correct.</p>
<p>How can I get the full locale support available for the functions declared in the template? I reckon it's that snapshot of chrome you are packaging... Thanks for any help here.</p>
<p><strong>VERSION: jsreport (node) v.2.1</strong><br />
In this version I'm getting a slightly better result, but still not right as the day should be first</p>
<blockquote>
<p>'02/28'</p>
</blockquote>
]]></description><link>https://forum.jsreport.net/post/2838</link><guid isPermaLink="true">https://forum.jsreport.net/post/2838</guid><dc:creator><![CDATA[vajnorcan]]></dc:creator><pubDate>Thu, 14 Jun 2018 07:15:56 GMT</pubDate></item><item><title><![CDATA[Reply to Template scripts: new Date().toLocaleDateString() not working properly on Invalid Date]]></title><description><![CDATA[<p>The <code>jsreport.exe</code> is compiled with normal node without extra localization. I am not sure how the size would grow if we would compile the localization there.</p>
<p>I believe we should get it running with full node and the arg <code>NODE_ICU_DATA</code> as you get it working in normal node.<br />
The problem could be that we fork extra process for templating engine evaluation and this process doesn't get the <code>NODE_ICU_DATA</code> propagated.<br />
Could you please try to change the config in v2 as this and try again with <code>NODE_ICU_DATA</code> set?</p>
<pre><code class="language-js">&quot;templatingEngines&quot;: {
    &quot;timeout&quot;: 10000,
    &quot;strategy&quot;: &quot;in-process&quot;
  }
</code></pre>
<p>This would make templating engines running in the same node process.<br />
I would try myself but wasn't able to quickly find that <code>intl</code> file, maybe you can link it here. Thanks.</p>
]]></description><link>https://forum.jsreport.net/post/2845</link><guid isPermaLink="true">https://forum.jsreport.net/post/2845</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>