# Node-red date picker issue

**URL:** <https://discourse.nodered.org/t/node-red-date-picker-issue/76567>\
**Category:** General\
**Created:** [14 March 2023 21:50 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567 "2023-03-14T21:50:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![daled](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@daled](https://discourse.nodered.org/u/daled)\
**Post date:** [14 March 2023 21:50 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/1 "2023-03-14T21:50:11Z")

</div>

I'm using node-red version 3.0.2. I observe that the date-picker node returns a random time on the date I select. This does not work for me (I want to add a specific time to the date). I observe that in github this problem was report on jul 10 of 2020 and was fixed, committed and merged the same day. But my installation is not doing what the committed code does (set hours, minutes, and seconds to 0 on the selected day).

Does anyone know why this is not working and what I can do to get it to work correctly?

See [Date Picker should return 12:00:00 AM GMT of date selected · Issue #599 · node-red/node-red-dashboard · GitHub](https://github.com/node-red/node-red-dashboard/issues/599)

---

<div class="post-metadata">

**Author:** ![daled](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@daled](https://discourse.nodered.org/u/daled)\
**Post date:** [21 March 2023 20:28 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/3 "2023-03-21T20:28:30Z")

</div>

I was mistaken in my original assessment.My confusion was caused by me having an inject node to set up the default date and not realizing that the time from that injection set a time that was then reused by the date picker node.

I do believe, however, that there is still a different issue...when picking a date, the date that is displayed on the calendar is sometimes one day less than the date that is output by the node. This appears to be somehow related to the users local timezone. I note that the date/time picker in the text input node does **not** have this behavior...it always outputs the exact day and time that is selected in UTC. I think that the date picker should behave the same way as the date/time picker. Perhaps with an option (for UTC), to avoid breaking existing flows?

---

<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:** [21 March 2023 21:08 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/4 "2023-03-21T21:08:06Z")

</div>

Can you provide two flows and the steps to take to demonstrate the issue? That would make it easier for someone to look at it.

---

<div class="post-metadata">

**Author:** ![daled](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@daled](https://discourse.nodered.org/u/daled)\
**Post date:** [21 March 2023 21:14 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/5 "2023-03-21T21:14:18Z")

</div>

Example: To duplicate, select the same date in both and see the debug output.

```auto
[
    {
        "id": "b5ce62e98aad3eee",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "a418eaf02ae38ac1",
        "type": "ui_date_picker",
        "z": "b5ce62e98aad3eee",
        "name": "",
        "label": "test",
        "group": "3d19d6bf7e0f488d",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": true,
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 290,
        "y": 160,
        "wires": [
            [
                "96347a4b0a6c5163"
            ]
        ]
    },
    {
        "id": "96347a4b0a6c5163",
        "type": "debug",
        "z": "b5ce62e98aad3eee",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 480,
        "y": 160,
        "wires": []
    },
    {
        "id": "4fc1d2693c80c7dd",
        "type": "ui_text_input",
        "z": "b5ce62e98aad3eee",
        "name": "",
        "label": "",
        "tooltip": "",
        "group": "3d19d6bf7e0f488d",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "mode": "datetime-local",
        "delay": "0",
        "topic": "topic",
        "sendOnBlur": true,
        "className": "",
        "topicType": "msg",
        "x": 330,
        "y": 280,
        "wires": [
            [
                "23e89604f744f512"
            ]
        ]
    },
    {
        "id": "23e89604f744f512",
        "type": "debug",
        "z": "b5ce62e98aad3eee",
        "name": "debug 10",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 540,
        "y": 280,
        "wires": []
    },
    {
        "id": "3d19d6bf7e0f488d",
        "type": "ui_group",
        "name": "test",
        "tab": "ddc03e87399db61c",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "ddc03e87399db61c",
        "type": "ui_tab",
        "name": "Test",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![daled](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@daled](https://discourse.nodered.org/u/daled)\
**Post date:** [22 March 2023 13:57 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/6 "2023-03-22T13:57:12Z")

</div>

Another way to state this issue: The date picker node seems to be aware of the local time zone and adjusts the output accordingly. The datetime picker in the text node does not adjust its output based on local time zone.

---

<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:** [22 March 2023 18:59 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/7 "2023-03-22T18:59:23Z")

</div>

What do you have set in the dashboard Date Format?  
 ![dashboard-date-format](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/0/903388a09c85e66468e39636495a18373c65fbc6.jpeg)

After playing I think what is happening is that what ever input you enter in the data/time picker, it is assuming that input is UTC-0 not your current UTC. For example I'm in UTC-4 but it I enter April 1st at 1:05 AM it must be assuming the date entered is n UTC time so it displays as 4 hours earlier because of my being in UTC-4

 ![Screenshot 2023-03-22 at 2.00.45 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/a/aa621e0b50339d8f47c2b9640e680a0ce84b6231.png)

@dceejay any thoughts about this?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [22 March 2023 19:37 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/8 "2023-03-22T19:37:21Z")

</div>

yes - something definitely slightly off... I haven't had a chance to dig into both scenarios - and which should be the "correct" answer. The intention of the date picker was to return the date (12 midnight of that day). - but there also seems to be some quirkiness about the hour shift of daylight saving time - if you select a day before or after the recent shift - so it's not simple.

---

<div class="post-metadata">

**Author:** ![daled](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@daled](https://discourse.nodered.org/u/daled)\
**Post date:** [22 March 2023 19:55 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/9 "2023-03-22T19:55:37Z")

</div>

Personally I think that the date-time picker is always doing the "correct" thing with the date that it generates. I'd like to see the date picker have an option to "use UTC" (like the chart node has) to behave the same way, (if it is necessary to retain the current [strange] behavior for backwards compatibility) . It appears that the local time zone somehow impacts the date picker, but not the date-time picker. If you inject a date with various times into the date picker, I notice that output date can change in subsequent selections on the GUI, again a function of my time zone....

@zenofmud : Thanks for the hint on the date format. I'm also in UTC-4 and I note that when within 4 hours of midnight the date picker seems to select the next day (which it is in GMT).

---

<div class="post-metadata">

**Author:** ![daled](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@daled](https://discourse.nodered.org/u/daled)\
**Post date:** [22 March 2023 19:59 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/10 "2023-03-22T19:59:22Z")

</div>

In my application I just want the user to select the UTC date so that the correct data file will be opened to display the data. The filenames are of the form xxxx-YYYY-MM-DD so getting a date other than the one selected is undesired. Using the date-time picker is awkward because its interface is more cumbersome and in my case the time is not needed.

---

<div class="post-metadata">

**Author:** ![daled](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@daled](https://discourse.nodered.org/u/daled)\
**Post date:** [20 April 2023 17:38 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/11 "2023-04-20T17:38:58Z")

</div>

@dceejay any chance you might find time to look at this? Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 June 2023 17:39 UTC](https://discourse.nodered.org/t/node-red-date-picker-issue/76567/12 "2023-06-19T17:39:49Z")

</div>

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