You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I can't format date & time to string with toLocaleString
To Reproduce
Steps to reproduce the behavior:
Create a script:
let date = new Date(2014, 11, 31, 12, 30, 0);
let formatter = new Intl.DateTimeFormat("ru");
log( 'date in ru : ' + formatter.format(date) ); // 31.12.2014
formatter = new Intl.DateTimeFormat("en-US");
log( 'date in en : ' + formatter.format(date) ); // 12/31/2014
let Now = new Date;
log( 'datetime in ru ' + Now.toLocaleString('ru-RU'));
log( 'datetime in de ' + Now.toLocaleString('de-DE'));
log( 'datetime in en ' + Now.toLocaleString('en-US'));
Run script
Scroll down to /opt/iobroker/log/iobroker.current.log
See the identical strings, as I see it:
2021-03-07 17:14:14.242 - .[32minfo.[39m: javascript.0 (28025) script.js.Test.testLocale: date in ru : 12/31/2014
2021-03-07 17:14:14.244 - .[32minfo.[39m: javascript.0 (28025) script.js.Test.testLocale: date in en : 12/31/2014
2021-03-07 17:14:14.245 - .[32minfo.[39m: javascript.0 (28025) script.js.Test.testLocale: datetime in ru 3/7/2021, 5:14:14 PM
2021-03-07 17:14:14.247 - .[32minfo.[39m: javascript.0 (28025) script.js.Test.testLocale: datetime in de 3/7/2021, 5:14:14 PM
2021-03-07 17:14:14.248 - .[32minfo.[39m: javascript.0 (28025) script.js.Test.testLocale: datetime in en 3/7/2021, 5:14:14 PM
Expected behavior
For date in ru expected - 31.12.2014.
For date in en expected - 12/31/2014.
Screenshots & Logfiles
I think it is not needed
Versions:
Adapter version: 4.11.00
JS-Controller version: 3.2.16
Node version: v12.21.0
Operating system: debian buster
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
PeterVoronov
changed the title
localisation is not worked, at least for date & time related functions
manual localisation is not worked, at least for date & time related functions
Mar 7, 2021
Describe the bug
I can't format date & time to string with toLocaleString
To Reproduce
Steps to reproduce the behavior:
Expected behavior
For date in ru expected - 31.12.2014.
For date in en expected - 12/31/2014.
Screenshots & Logfiles
I think it is not needed
Versions:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: