# Time Picker in ui\_form node sends wrong time in output payload

**URL:** <https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296>\
**Category:** Dashboard\
**Tags:** home-assistant\
**Created:** [26 November 2022 18:08 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296 "2022-11-26T18:08:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tilerdon](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tilerdon](https://discourse.nodered.org/u/Tilerdon)\
**Post date:** [26 November 2022 18:08 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/1 "2022-11-26T18:08:25Z")

</div>

This is my first post on this forum though I've been using Node-RED for just over a year now. I hope I get it right

I have a form element with type "Time"

On focus the dropdown displays the current time as the default correctly but on submission the hour has been reduced by 1 hour. This occurs both using Microsoft Edge and the AVG Secure Browser. All other times in my system display correctly

I am running the Node-RED integration version 13.5.3 under Home Assistant Home Assistant 2022.11.4  
Supervisor 2022.11.2  
Operating System 9.3  
Frontend 20221108.0 - latest

I produced a simple flow to exemplify the problem

![Screenshot 2022-11-26 175336](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/0702c2e2174c109ecf000d5f714f94b26da77f66.png)

```auto
[{"id":"2fbaad6f2b46c829","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"5a3f7a04aed08be7","type":"debug","z":"2fbaad6f2b46c829","name":"debug 40","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":160,"wires":[]},{"id":"a5cf4986139c19c7","type":"ui_form","z":"2fbaad6f2b46c829","name":"Switches","label":"<font color= {{msg.color}} > {{msg.payload}}</font>","group":"343f7063521c327e","order":10,"width":0,"height":0,"options":[{"label":"Start Time","value":"Start","type":"time","required":true,"rows":null},{"label":"End Time","value":"End","type":"time","required":false,"rows":null},{"label":"State","value":"State","type":"switch","required":true,"rows":null},{"label":"All Days","value":"All","type":"checkbox","required":false,"rows":null},{"label":"Sun","value":"Sun","type":"checkbox","required":false,"rows":null},{"label":"Mon","value":"Mon","type":"checkbox","required":false,"rows":null},{"label":"Tue","value":"Tue","type":"checkbox","required":false,"rows":null},{"label":"Wed","value":"Wed","type":"checkbox","required":false,"rows":null},{"label":"Thu","value":"Thu","type":"checkbox","required":false,"rows":null},{"label":"Fri","value":"Fri","type":"checkbox","required":false,"rows":null},{"label":"Sat","value":"Sat","type":"checkbox","required":false,"rows":null}],"formValue":{"Start":"","End":"","State":false,"All":false,"Sun":false,"Mon":false,"Tue":false,"Wed":false,"Thu":false,"Fri":false,"Sat":false},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":true,"className":"","x":300,"y":160,"wires":[["5a3f7a04aed08be7"]]},{"id":"a6cb819ce376fc58","type":"inject","z":"2fbaad6f2b46c829","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":160,"wires":[["a5cf4986139c19c7"]]},{"id":"343f7063521c327e","type":"ui_group","name":"test","tab":"62712bbf.888b94","order":3,"disp":true,"width":"6","collapse":false,"className":""},{"id":"62712bbf.888b94","type":"ui_tab","name":"test","icon":"dashboard","disabled":false,"hidden":false}]

```

Unfortunately as a new user I'm unable to post the screenshots of the Input form and data and the object shown by debug

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [26 November 2022 19:20 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/2 "2022-11-26T19:20:50Z")

</div>

@Tilerdon welcome to the forum.

What timezone are you in?  
Please run your flow and then expand the output of the `debug` node and copy/paste it to a reply.

There’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

---

<div class="post-metadata">

**Author:** ![Tilerdon](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tilerdon](https://discourse.nodered.org/u/Tilerdon)\
**Post date:** [26 November 2022 19:23 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/3 "2022-11-26T19:23:30Z")

</div>

It wouldn't let me do it in the original post.

I'm literally 3 miles from the Greenwich Meridian

 ![Screenshot 2022-11-26 170203](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/f/1ff8563b12710c64a2c5338dce77c709c4c5fa87.png)

 ![Screenshot 2022-11-26 170356](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/c/ac6708338ecd5c9764c687f0779bc1e020431566.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [26 November 2022 19:29 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/4 "2022-11-26T19:29:32Z")

</div>

Can you click on the hamburger menu (top right) in the editor and select the 'Manage palette'go to the 'Palette Manager' then search for 'dashboard' and tell me what version you are running.

---

<div class="post-metadata">

**Author:** ![Tilerdon](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tilerdon](https://discourse.nodered.org/u/Tilerdon)\
**Post date:** [26 November 2022 19:41 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/5 "2022-11-26T19:41:55Z")

</div>

Version 3.2.0

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [26 November 2022 20:07 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/6 "2022-11-26T20:07:50Z")

</div>

latest version is 3.2.3 but don't worry about that for the moment. My concern is why the Start time has a date of 1970... I'm going to look into that a bit.

---

<div class="post-metadata">

**Author:** ![Tilerdon](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tilerdon](https://discourse.nodered.org/u/Tilerdon)\
**Post date:** [26 November 2022 20:37 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/7 "2022-11-26T20:37:52Z")

</div>

I only put the date input element in there to try and correct that but it had no effect. The dropdown Calendar in the Date input did correctly highlight today

To put a few things into perspective - I'm 74 years old and until August 2021 I had never heard of Home Assistant or Node-RED, and knew nothing about the use of JavaScript, Linux, VirtualBox, HTML, CSS and many of the other components used in the Home Automation Project.

I have a programming background but only in the conventional languages used in the latter half of the last century. I hadn't done anything serious with a computer since 2004. But this is my main Node-RED Dashboard

 ![Screenshot 2022-11-26 202759](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/0/d0a2a48bcb566618c573e8f998c9ece245154de1.png)

It monitors and controls my whole house heating system along with some lights, and a few other devices. Apart from the Tuya, Tapo, and Meross devices there are at present 3 home built devices, One a temperature sensor, one a set of 3 thermometers that display the water temperatures at 3 levels in a hot water storage cylinder and finally the main boiler programmer which itself is over 1000 lines of C++

But in truth I don't count myself as competent in any of these things - although I'm not really sure how to use the debug sidebar to any more effect than reading the debug output itself . Even though it works and I saved over $1200 in Heating Oil during the last year.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [26 November 2022 21:25 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/8 "2022-11-26T21:25:37Z")

</div>

> [@Tilerdon](#):
>
> To put a few things into perspective - I'm 74 years old

I'm not that far behind you 😄, that said you done a lot! That dashboard looks great!

All dates and times are stored (if I have this right) as a Unix timestamp. The reason the date shows up with a 1970...date is that it is translated into the amount of milliseconds offset from the UNIX base time which is 1970-01-01T00:00:00.000Z.

If I'm not mistaken, your day light savings time started a couple weeks ago. So I think what you are seeing is the correct time just offsetted by DST.

You always want to store data and time as a UNIX timestamp and then correct the offset based on your time zone. For instance, If I enter 17:00 I get a value in the debug of `1970-01-01T10:09:00.000Z` because I'm in the US.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 November 2022 21:46 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/9 "2022-11-26T21:46:48Z")

</div>

In the UK DST ended recently so we are now on UTC. I am seeing the same symptom as @Tilerdon. It is certainly appears to be wrong. What time zone are you in @zenofmud?

---

<div class="post-metadata">

**Author:** ![Tilerdon](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tilerdon](https://discourse.nodered.org/u/Tilerdon)\
**Post date:** [26 November 2022 21:48 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/10 "2022-11-26T21:48:52Z")

</div>

We are now in GMT , Our summertime is the aberration from normal time so no adjustment should be necessary at this time of year

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 November 2022 21:56 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/11 "2022-11-26T21:56:16Z")

</div>

I have checked with a Form with only a Time field and it shows the same issue, so it is nothing to do with the other stuff in the form.  
I am using NR 3.0.2 and dashboard 3.2.3, nodejs 16.18.1

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 November 2022 01:41 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/12 "2022-11-27T01:41:45Z")

</div>

I'm on Eastern Standard Time (GMT-5)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 November 2022 03:29 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/13 "2022-11-27T03:29:47Z")

</div>

That is a swish (nice) dashboard.

Top marks for it.

---

<div class="post-metadata">

**Author:** ![Tilerdon](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tilerdon](https://discourse.nodered.org/u/Tilerdon)\
**Post date:** [27 November 2022 07:28 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/14 "2022-11-27T07:28:07Z")

</div>

Thank you, that is very kind of you to say so

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2022 07:50 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/15 "2022-11-27T07:50:54Z")

</div>

> [@zenofmud](#):
>
> Eastern Standard Time (GMT-5)

Doesn't that mean you should get 22:00Z when you enter 17:00?

---

<div class="post-metadata">

**Author:** ![Tilerdon](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tilerdon](https://discourse.nodered.org/u/Tilerdon)\
**Post date:** [27 November 2022 09:55 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/16 "2022-11-27T09:55:49Z")

</div>

I've gone back to the Form that I am actually working on rather than just using the test flow that I started with in this discussion. As I said earlier, I did actually only include the Date element forthe purpose of analysing this problem. I do however believe it shows that the REAL time and date values are available to the Form node but it corrupts them on output.

 ![Screenshot (1)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/670c92d7aaf06e8fe407d50adeb99e8c2f1a7c91.png)

This shows the Calendar dropdown Highlighting todays date - 27 Novemeber 2022 - which I select

 ![Screenshot (3)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c36df14b57cb5131b9a542f37311ec9491bd490e.png)

The Time Picker dropdown also shows the current time (check this with Windows Time/Date in Taskbar)

 ![Screenshot_20221127_094046](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/cc2c6eef9921994c26abce2282ca2ff1aec37dac.png)

Date is held correctly in the msg.payload object but the Start time is corrupted and I can see no way that I can influence the output of the Form node to correct it other than by cocing in my own calculations for the date ranges of when we are on UTC or DST.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 November 2022 10:51 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/17 "2022-11-27T10:51:50Z")

</div>

It is working correctly for me. Here is what I pick:  
 ![Screen Shot 2022-11-27 at 5.45.48 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b50ade5cb6397558291eb4817e784c3fb508e490.png)

and here is the debug - notice the date portion of the timestamp is 5 hours off as it should be.  
 ![Screen Shot 2022-11-27 at 5.49.53 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0f7094ca801ad32b73dc4b52d69d31797184a270.png)

Please update the ui-form node to the latest v3.2.3 If you notice on my form it shows the AM/PM but on yours it doesn't  
 ![Screen Shot 2022-11-27 at 5.52.39 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a92e21ac5c5d386f38f36c1ab7655974811e6f03.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2022 11:01 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/18 "2022-11-27T11:01:34Z")

</div>

> [@zenofmud](#):
>
> here is the debug -

I think maybe you pasted the wrong image for the debug.

> [@zenofmud](#):
>
> Please update the ui-form node to the latest v3.2.3 If you notice on my form it shows the AM/PM but on yours it doesn't

I am running on v3.2.3

I believe whether it shows am/pm or not is down to the locale settings. On Android,for me, it shows a clock.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 November 2022 11:14 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/19 "2022-11-27T11:14:43Z")

</div>

Yup!, grabbed the wrong image - fixed, thanks

@Tilerdon what do you see in the `debug` if you edit the `inject` node and set msg.topic to display a timestamp, do a deploy, press the `inject` then in the dashboard enter the current time. Look at the debug and click on the value in the topic and you will see it rotate thru various representations of the time. When it gets to the 'topic: 2022-11-27T`11`:00:44.897Z' format, does the time offset (which I hi-lighted in red' match the time offset at the top of the debug message `11/27/2022, 6:01:01 AMnode: debug 40`. Since I GMT-5 if I add 5 to the time hour (6) it is 11 as it should be.

Also have you tried this in Fierefos and or Chrome and from another computer on our network?

One other thing, when you click on the msg.topic time, click till you see the time shown with the (UTC-5) format. What is it showing?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2022 11:36 UTC](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/20 "2022-11-27T11:36:36Z")

</div>

I have done what you suggested for @Tilerdon and get

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/36573ccaafd8564465f0f23bc271e1292075b0db.png)

It is 11:30 (UTC) here which is what I put in the start time field.

[Next page](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296.md?page=2)
