# Dashboard ui\_Form Date

**URL:** <https://discourse.nodered.org/t/dashboard-ui-form-date/32511>\
**Category:** Dashboard\
**Created:** [6 September 2020 15:24 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511 "2020-09-06T15:24:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [6 September 2020 15:24 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/1 "2020-09-06T15:24:44Z")

</div>

I configurated a ui\_Form with an Input Field of type "Date".

The output of Date is always one day backwards to what i picked.(e.g picked 12.03.2020 - \> Output : 11.03.2020)

How can i get the same Date i picked as Outout?

---

<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:** [6 September 2020 15:45 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/2 "2020-09-06T15:45:40Z")

</div>

Feed the output into a debug node and show us what it says

---

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [6 September 2020 15:47 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/3 "2020-09-06T15:47:36Z")

</div>

2020-09-18T22:00:00.000Z

Input was 19.09.2020.

i think its something about the "Z" after time

---

<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:** [6 September 2020 16:15 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/4 "2020-09-06T16:15:05Z")

</div>

What timezone are you, and what time was it?

---

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [6 September 2020 16:21 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/5 "2020-09-06T16:21:52Z")

</div>

My RPI is running UTC+1

---

<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:** [6 September 2020 16:29 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/6 "2020-09-06T16:29:59Z")

</div>

Can you run, in a terminal,

```auto
node-red-stop
node-red-start

```

And copy/paste the result here. Use the `</>` button and paste the text in.

---

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [6 September 2020 17:22 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/7 "2020-09-06T17:22:59Z")

</div>

```auto
Once Node-RED has started, point a browser at http://192.168.178.35:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
6 Sep 19:21:50 - [info]
Welcome to Node-RED
===================
6 Sep 19:21:50 - [info] Node-RED version: v1.1.0
6 Sep 19:21:50 - [info] Node.js version: v12.17.0
6 Sep 19:21:50 - [info] Linux 4.19.118-v7+ arm LE
6 Sep 19:21:51 - [info] Loading palette nodes
6 Sep 19:22:02 - [info] Worldmap version 2.0.18
6 Sep 19:22:03 - [info] Dashboard version 2.23.0 started at /ui
6 Sep 19:22:05 - [info] Settings file : /home/pi/.node-red/settings.js
6 Sep 19:22:05 - [info] Context store : 'default' [module=memory]
6 Sep 19:22:05 - [info] User directory : /home/pi/.node-red
6 Sep 19:22:05 - [warn] Projects disabled : editorTheme.projects.enabled=false
6 Sep 19:22:05 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
6 Sep 19:22:05 - [info] Server now running at http://127.0.0.1:1880/
6 Sep 19:22:05 - [warn]

```

---

<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:** [6 September 2020 19:09 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/8 "2020-09-06T19:09:09Z")

</div>

It would be worth upgrading node-red to the latest, there were some issues with 1.1.0, though I don't expect it to be the problem here (`sudo npm install -g --unsafe-perm node-red`) then restart node-red.  
Also upgrade the dashboard, which you can do via Manage Palette, though I am not hopeful that will help either.  
What browser are you using and can you try a different one?

---

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [7 September 2020 09:04 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/9 "2020-09-07T09:04:35Z")

</div>

I ran the update but as expected no difference 🙂

---

<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:** [7 September 2020 09:17 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/10 "2020-09-07T09:17:16Z")

</div>

And the browser question?

---

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [7 September 2020 09:40 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/11 "2020-09-07T09:40:49Z")

</div>

> [@Colin](#):
>
> sudo npm install -g --unsafe-perm node-red

Same on Vivaldi Browser.

I tried it also running node-red on WIndows...same here

---

<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:** [7 September 2020 09:49 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/12 "2020-09-07T09:49:32Z")

</div>

Odd, can you export a mini flow just consisting of the ui nodes needed and a debug node that shows the problem?

---

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [7 September 2020 09:59 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/13 "2020-09-07T09:59:24Z")

</div>

```auto
[{"id":"2011d220.e28e8e","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ae565e9b.4a724","type":"ui_form","z":"2011d220.e28e8e","name":"","label":"Date in Form","group":"5a80f7fa.fb5098","order":2,"width":"0","height":"0","options":[{"label":"Datum","value":"Datum","type":"date","required":true,"rows":null}],"formValue":{"Datum":""},"payload":"","submit":"submit","cancel":"cancel","topic":"","x":330,"y":200,"wires":[["deaad8a1.fb7b48"]]},{"id":"deaad8a1.fb7b48","type":"ui_text","z":"2011d220.e28e8e","group":"5a80f7fa.fb5098","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":560,"y":200,"wires":[]},{"id":"5a80f7fa.fb5098","type":"ui_group","z":"","name":"Date(Form)","tab":"449bd675.359ec8","order":1,"disp":true,"width":"6","collapse":false},{"id":"449bd675.359ec8","type":"ui_tab","z":"","name":"TestTaB","icon":"dashboard","order":4,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 September 2020 10:06 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/14 "2020-09-07T10:06:36Z")

</div>

> [@knubbl](#):
>
> `Dashboard version 2.23.0`

Try updating dashboard to latest. There was a fix around the date picker which I believe was added just after release of v2.23.0

> <https://github.com/node-red/node-red-dashboard/commit/d7b82bc2fa8dbc7cc02ab7a4407d2d1973815f5b>
>
> Proposed fix for https://github.com/node-red/node-red-dashboard/issues/599

---

<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:** [7 September 2020 10:09 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/15 "2020-09-07T10:09:50Z")

</div>

@knubbl indicated that he had already updated the dashboard, I suggested that earlier, but perhaps it was not done.

---

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [7 September 2020 10:12 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/16 "2020-09-07T10:12:27Z")

</div>

Date picker is working fine.

The problem is the ui\_form in which i put a date input field

---

<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:** [7 September 2020 10:21 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/17 "2020-09-07T10:21:48Z")

</div>

> [@knubbl](#):
>
> Date picker is working fine.

Can you confirm that you have updated the dashboard? Also confirm what you see from the flow you posted and the timezone of the machines running the browser and node red.  
For me, when I enter 19/09/20 it gives `{"Datum":"2020-09-18T23:00:00.000Z"}` which is a timestamp for the start of the day in local time (23:00 on 18th UTC, which is midnight UTC+1), which I assume is what the node is supposed to provide.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 September 2020 10:25 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/18 "2020-09-07T10:25:38Z")

</div>

Demo...

Chosen date was 2020/09/06...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/28ece57c9ad9e7396737d2852bd56349368f01f3.png)  
... times are output in UTC, I am in UTC+1 (so add the offset and you get 00:00 of the correct date)

The issue is purely visual - the date / time is in-fact correct, merely represented as UTC.

If need be, you can use a function like below to get a local date/time representation...

```auto
function convertUTCDateToLocalDate(date) {
    var newDate = new Date(date.getTime()+date.getTimezoneOffset()*60*1000);

    var offset = date.getTimezoneOffset() / 60;
    var hours = date.getHours();

    newDate.setHours(hours - offset);

    return newDate;   
}

```

---

<div class="post-metadata">

**Author:** ![knubbl](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@knubbl](https://discourse.nodered.org/u/knubbl)\
**Post date:** [7 September 2020 12:33 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/19 "2020-09-07T12:33:09Z")

</div>

Get the following error message

TypeError: date.getTime is not a function

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 September 2020 12:50 UTC](https://discourse.nodered.org/t/dashboard-ui-form-date/32511/20 "2020-09-07T12:50:47Z")

</div>

> [@knubbl](#):
>
> TypeError: date.getTime is not a function

This means your `date` is not a date object (It is likely an epoch or string)

Try this instead...

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

Flow to import...

```auto
[{"id":"35156752.400eb8","type":"function","z":"ebd0d71c.0bad18","name":"date parser","func":"\nlet d = new Date(msg.payload.date)\nlet dateTimeLocal = new Date(d.getTime() - (d.getTimezoneOffset() * 60000)).toISOString().slice(0,23).replace(\"T\",\" \");\nlet dateLocal = dateTimeLocal.slice(0,10)\nmsg.payload = {\n dateObject: d,\n dateTimeLocal: dateTimeLocal,\n dateLocal: dateLocal,\n}\nreturn msg;","outputs":1,"noerr":0,"x":1110,"y":140,"wires":[["fcb55760.fde188"]]},{"id":"ef045e1a.6dddb","type":"ui_form","z":"ebd0d71c.0bad18","name":"","label":"","group":"376c9cdf.3d0184","order":0,"width":0,"height":0,"options":[{"label":"date","value":"date","type":"date","required":true,"rows":null}],"formValue":{"date":""},"payload":"","submit":"submit","cancel":"cancel","topic":"","x":1050,"y":100,"wires":[["35156752.400eb8"]]},{"id":"fcb55760.fde188","type":"debug","z":"ebd0d71c.0bad18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1170,"y":180,"wires":[]},{"id":"376c9cdf.3d0184","type":"ui_group","z":"","name":"UserEntry","tab":"4af0eb21.b30c04","order":1,"disp":true,"width":"6","collapse":false},{"id":"4af0eb21.b30c04","type":"ui_tab","z":"","name":"Home","icon":"home","order":1}]

```

[Next page](https://discourse.nodered.org/t/dashboard-ui-form-date/32511.md?page=2)
