node-red-contrib-ui-time-scheduler icon indicating copy to clipboard operation
node-red-contrib-ui-time-scheduler copied to clipboard

Scheduler yields incorrect days for local time

Open camx opened this issue 1 year ago • 1 comments

If I enter a time beyond the UTC-Local time midnight difference the scheduler returns the wrong day. That sounds cryptic to me, and I wrote it, so let me give an example.

My local time difference is UTC-5. Say it is Sun and I schedule a time span [19:00, 19:03] then the issued schedule is for the next day, Mon, instead of today.

A time span [18:59, 1903] is scheduled for the correct day. The threshold value is the difference between UTC and Local time, 24:00-5:00 = 19:00.

I haven't tested it, but I suspect the timer outputs (as opposed to the schedule: output 1), function correctly.

image

{"timers":[{"starttime":1719187200000,"days":[0,1,0,0,0,0,0],"output":"0","endtime":1719187320000}],"settings":{}} which should be ... "days":[1,0,0,0,0,0,0],...

starttime and endtime are also displaced to the next day instead of the current one.

camx avatar Jun 23 '24 16:06 camx

Hi @camx,

yes you are right. The days array ("days":[...]) stores its values in UTC time. It then recalculates the execution time based on your local time.

This makes sure that you will always see the correct time in your browser. Just image the following scenario: You create a schedule in your Node Red instance in your browser (UTC-5) at Sunday 19:00 to 19:05 - you would see exactly that. If I would then open your Node Red instance in my browser (UTC+1) it then would display Monday 01:00 to 01:05.

Let me know if you have any questions!

fellinga avatar Jul 06 '24 13:07 fellinga