Australia date format (DD Month YYYY) is not working in 2.11.0 version of jsreport
-
Hello @jan_blaha @bjrmatos
Hope you are doing well.I am having trouble with some Australia date format in my custom report. It is working fine in playground but not working my project. other format are working fine in my project but the DD/Month/YYYY is not working.
I'm using below code(Please have a look at playground)
https://playground.jsreport.net/w/Heplinesss_17/o0eYS~qvI'm using 2.11.0 jsreport version. Is there any possibility that issue is happening because of older version? or if you have any other idea?
Thanks!
-
hi @Happy-Patel
yes, the problem is because the
Intl
api needs to haveICU
data available to support different locales, etc.nodejs <=12 comes with just a small ICU dataset available by default, so
Intl
in this case only works with English as far I remember. jsreport 2.11.0 supports nodejs >=8 and I believe until node.js 14node >=13 comes with full ICU dataset available by default,
Intl
should work ok here with different locales, jsreport >=v3 minimum node.js version is node.js 14, the playground uses jsreport v3 so it is expected theIntl
works just fine there.what you need to do depends on the node.js version you are using:
- follow the steps here to provide your existing node.js version with the full ICU dataset, as you can see it is just a matter of installing a packages and adding extra arg to the node.js command you use to start the server.
- you can also upgrade your node.js version to 14, doing that will make the jsreport 2.11.0 have the
Intl
working as expected because the node.js version comes with full ICU dataset available.
i recommend you to just follow the approach #1, it is easier and you won't need to change the node.js version of your app.
-
Hello @bjrmatos
Thanks for your reply! I am using
node js 14.16.0
so as per you said It should work with this node version correct? But it's not working with node version > 14
-
yes, it should work there with node 14.16. I've installed 2.11.0 and imported your same template and I get the same results as a playground.
I am not sure why it does not work for you. what is the output that you get?
-
Hey @bjrmatos ,
There is a problem with the node version docker, I think it is not 14. Is it possible to break existing templates if I update node version in docker?
Thanks!
-
upgrading the node version shouldn't break templates, but this also depends on the code you already have on the templates (like helpers, o scripts) or third party modules installed (in helpers, scripts).
since you have docker i guess it is easier to test the node version upgrade, but as always before doing it make sure you backup and make a copy of your templates and related entities.
-
Thanks @bjrmatos