Time confused? System is UTC, form entered time is local? But form returns wrong UTC encoding? Appears to be 1 hour off, like it is ignoring DST?

OK system is UTC as it should be, but when I enter say 9pm (local) on a NR form, UTC should 4am (where I am) but is shown as 5am, which means DST is ignored?

Form result for 9pm entered... 1970-01-02T05:00:00.000Z clearly that is not right.

I confirmed via UTC internet, 9am local should be 4am UTC, not 5am UTC. Any idea why this is happening?

System is correct...

# date
Thu 23 Mar 2023 04:04:08 AM UTC

# date +"%Z %z"
UTC +0000

So where is the NR form getting 5am for UTC?

Exactly how are you entering the date and exactly how are you displaying it?
Please post a simple flow for us to test.

What time zone is the machine running the browser set to?

Probably related to this

Type 9 tab 00 tab, arrow to select PM, enter, for 09:00 PM. I mean that is pretty straight forward right?

Where have we got to do that? You haven't posted a flow.

You haven't answered that question. It may be relevant.

I already provided the time zone configuration see above. The flow is not relevant. Just create a form and add a time input control, and test it. See my original post, system is UTC, time entered is local, the resulting ISO time format string is 1 hour off what UTC should be, which is in my area is exactly off by local DST. The message that results I send to a UI table but watching it with a debug node, same result.

If I enter 9pm local, UTC should be 4am. This works in OS, as expected, but in NR, in a time control on a form, the resulting ISO string is 5am. That is 1 hour off, and we just shifted to DST a few weeks ago, I live in USA, CA. Could be a JavaScript bug? Quirk?

Input...

image

Result...

image

Flow fragment...

[{"id":"a543d11d99499b0c","type":"ui_form","z":"4f2bc113e5ffb8b9","name":"Schedule","label":"Schedule","group":"a4af7f53ae04cc5e","order":5,"width":18,"height":1,"options":[{"label":"Task","value":"task","type":"text","required":true,"rows":null},{"label":"Active","value":"active","type":"checkbox","required":false,"rows":null},{"label":"Time","value":"time","type":"time","required":true,"rows":null},{"label":"Duration","value":"duration","type":"number","required":true,"rows":null},{"label":"Sunday","value":"sunday","type":"checkbox","required":false,"rows":null},{"label":"Monday","value":"monday","type":"checkbox","required":false,"rows":null},{"label":"Tuesday","value":"tuesday","type":"checkbox","required":false,"rows":null},{"label":"Wednesday","value":"wednesday","type":"checkbox","required":false,"rows":null},{"label":"Thursday","value":"thursday","type":"checkbox","required":false,"rows":null},{"label":"Friday","value":"friday","type":"checkbox","required":false,"rows":null},{"label":"Saturday","value":"saturday","type":"checkbox","required":false,"rows":null}],"formValue":{"task":"","active":false,"time":"","duration":"","sunday":false,"monday":false,"tuesday":false,"wednesday":false,"thursday":false,"friday":false,"saturday":false},"payload":"","submit":"Task","cancel":"Cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":180,"y":60,"wires":[["f3d65db0ba5ac41e"]]},{"id":"75dfd29e3fee10b4","type":"debug","z":"4f2bc113e5ffb8b9","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":460,"y":60,"wires":[]},{"id":"f3d65db0ba5ac41e","type":"link out","z":"4f2bc113e5ffb8b9","name":"link out 1","mode":"link","links":["639266f7bd0eee2c","22d4791030420326"],"x":285,"y":60,"wires":[]},{"id":"22d4791030420326","type":"link in","z":"4f2bc113e5ffb8b9","name":"link in 1","links":["220b94a29a114b28","f3d65db0ba5ac41e"],"x":345,"y":60,"wires":[["75dfd29e3fee10b4"]]},{"id":"a4af7f53ae04cc5e","type":"ui_group","name":"Irrigation","tab":"62b26ca3a854f6d1","order":1,"disp":true,"width":18,"collapse":true,"className":""},{"id":"62b26ca3a854f6d1","type":"ui_tab","name":"Garage","icon":"dashboard","disabled":false,"hidden":false}]

Note, in my original post, I note 9pm, but later in the post, 9am is noted, that is a typo, both 9 hour references should be PM. Consistent with the example provided above.

Does the same in the UK. Enter 19:30 and get 18:30 out. BST doesn't start until Sunday. Is it something to do with the fact that the date being used is 1970-01-0x?

The reason for the 'x' in minutes, above the minutes are 02 and mine they are 1970-01-01T18:30:00.000Z

In the UK daylight saving time was in effect all year round in 1970.
Even if you don't want to use the year part, you need to change it to this year to ensure the DST adjustment matches up to this year's calendar.

Yep, but with the Form time input you do not get a choice. This is the date used by the widget, that is what I think the problem is

There is a discussion of (probably) this topic at https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/54

So... in short there is no way to address this? But to force the system clock to some odd offset or something other than UTC, so the forum time widget can be used effectively? I guess I could stop using the canned time widget and just use a text box? But then I would have to parse the input?

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