I am having some trouble with the timestamps and dates in general.
My time zone is UTC (Europe/Lisbon) but when DST kicks in the time changes to UTC+1
The problem is that node-red does not take the DST in to account. So now whenever I create a date its created with the UTC time.
I also used the moment.js library, but get the same problem. This is where things get wierder.
I set up a timestamp inject that runs a function node with the following code:
msg.nowlocal=moment().local() //current datetime in local
msg.now=moment() //current datetime
msg.utc=moment().utc() //current datetime in utc
msg.nowlocaloffset=moment().local().utcOffset() //difference from current datetime local to UTC
msg.nowoffset=moment().utcOffset() //difference from current datetime to UTC
msg.utcoffset=moment().utc().utcOffset() //difference from UTC datetime to UTC - has to be 0
Using the local() should get me my timezone date, and the utc() should get me the UTC. The utcOffset() gives me the difference between the date generated and UTC time.
The response is the following:
The current time is 2019-04-11T07:59:13.702Z. How can the nowlocal and now dates have the same timestamp as the utc one and still report a +60minute shift from it?
Can anyone help me?
Thanks in advance.