I'm not using Docker (it almost doesn't work on RPi 1B because of ARMv6). And I must admit that I ended up in this thread from Google and thought it's the same issue as mine though I'm focusing on NR editor and not the logs.
As for new Date()
, when I run it locally in my browser, it returns local, not UTC. I need to call toUTCString()
to get UTC, not local:
x = new Date()
Date Fri Dec 18 2020 11:27:17 GMT+0100 (czas środkowoeuropejski standardowy)
x.toUTCString()
"Fri, 18 Dec 2020 10:27:17 GMT"
I would assume NR running on RPi should use the same date/timezone as date
command is returning, not the UTC.
As for Inject node, I select Repeat at a specific time
and have.. say 10:00. That flow sends a mail and Telegram chat. Both are sent at 11:00.
Here is simple test flow:
[{"id":"79ebeb20.476aa4","type":"inject","z":"4103e39d.49460c","name":"Set at 10:00, will be invoked at 11:00","props":[{"p":"payload"}],"repeat":"","crontab":"00 10 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":340,"wires":[["54aa1cbf.4adfac"]]},{"id":"54aa1cbf.4adfac","type":"function","z":"4103e39d.49460c","name":"Sends new Date(), time will be in UTC, not local","func":"msg.payload = `Date: ${(new Date())}`;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":680,"y":340,"wires":[["968f63de.464fa","feb29d40.8a59d"]]},{"id":"feb29d40.8a59d","type":"debug","z":"4103e39d.49460c","name":"Here I send it via mail/Telegram","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":340,"wires":[]}]
Debug response is "Date: Fri Dec 18 2020 10:33:56 GMT+0000 (Greenwich Mean Time)"
, I would expect it to be the same as date
command, so:
pi@raspberrypi:~ $ date
Fri 18 Dec 11:35:07 CET 2020
So while formatting Date()
can be done in function node (altough JS does not have nice tools for that, but anyway, this could be done), Inject node would require manual adjusting (2 times a year for DST probably), not a good solution.
Probably I should create new thread instead of hijacking this one - I just assume it's the same issue.