Wrong date format?


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?


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

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.

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.

Thanks, it is 2.1.4

And the nodejs version?

pi@tuotanto:~ $ node -v


and date in RPi

pi@tuotanto:~ $ date

Mon 7 Mar 15:47:50 EET 2022

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.