Hi,
I have this in Function node
var d = new Date();
//var dt = d.toLocaleString("fi-FI", { timeZone: 'Europe/Helsinki' });
var dt = d.toLocaleString("fi-FI");
msg.payload = dt + "," + msg.payload;
return msg;
accroding this
I should get this
6.3.2022 klo 19.55.53
but I get this
"3/6/2022, 20:01:26,temp"
i.e. month and day in wrong order?
When I run your function, I get the correct format
What version of NR and node.js? (you can find them in the start up log)
What computer are you using?
Hi,
I have updated to latest but I don't want to restart my NR, is there and other way to see NR version?
I'm running it in Rasperry PI
Colin
7 March 2022 13:23
4
It is at the bottom of the menu dropdown. Also in Manage Palette in the menu.
To get the nodejs version run
node -v
in a shell. It could be that you are using an old version. toLocaleString() did not work well in some versions.
E1cid
7 March 2022 13:36
5
Finnish locales
The all-numeric form for dates is in the order “day month year”, using a full stop as the separator. Example: “31.5.2002” or “31.5.02”. Years can be written with two or four digits, nowadays usually with four, and numbers may be written with or without leading zero.
So the output would be correct for Finnish Locale.
https://hds.hel.fi/guidelines/data-formats
system
Closed
6 May 2022 13:50
9
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.