Hi,
last year I used the "Simpletime" node. I remember using the following code:
if(msg.mymonthn>=4||(msg.mymonthn<=10&&msg.mydom<27)){//adjust based on Daylight savings time
msg.myhour+=1;
}
else{
msg.myhour-=1;
}
I am trying to recreate it at the moment, but having issues. The node has changed. Now I want to know if the node uses the computer time?
I remember having to adjust for DST, but now I don't (testing locally). Also I remember when I added an hour it actually took away an hour. Can anyone help with clarifying as the documentation doesn't say where the source of time is from.
Simpletime uses, and has always used Date() to determine the base time, on which the calculations are based.
Which in turn uses the user's local (browser's) timezone.
No changes have been made to this since the node was first written, so it's likely that at some stage your system has changed to respect your current timezone. Is that likely?
I don't think that code will actually work for at least 2 reasons anyway;
The values from Simpletime are all strings, not numbers, so if the hour was 15, and the calculation was msg.myhour+=1; wouldn't the resulting value be 151?
Again if the hour was 15, and you added an hour from msg.myhour (+=1) the result would be 16, whilst subtracting an hour from msg.myhour (-=1) would result in 14.
Meaning that there is a 2hr difference between GMT & IST(BST) which is incorrect.
Not now. But when I tested it last year I was using IBM's version of node-red(hosted in London) and I remember having to adjust for DST. At the moment I'm not having that issue.