# Pre-fill datetime picker (text input node) doesn't show date and time

**URL:** <https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [21 February 2022 21:57 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771 "2022-02-21T21:57:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![garson](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@garson](https://discourse.nodered.org/u/garson)\
**Post date:** [21 February 2022 21:57 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/1 "2022-02-21T21:57:47Z")

</div>

Hello everyone.

I am new to Node-red so will need a bit of help. 🙂

I am running Node-red 2.2.0 with nodejs v17.5.0 on Asus Tinker Board (running DietPi v8.1).

I have pretty simple flow where I have "Date picker node" and "Text input node" (set to time picker mode), and a function that injects date and time to these 2 node. Function just has pretty much this:  
msg.payload = new Date('01/01/2022')};

This works fine and I have date and time pre-filled in these 2 node as shown on screenshot.  
 ![separate time and date](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/3/f384416032dfd9eebfc8d3a5f97935066ba9157b.jpeg)

Now I want to use Text input node set to datetime picker mode instead of separate time and date nodes. But prefill doesn't work here, date and time are not shown, I get just "dd-----yyyy --:--" :  
 ![datetime](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/6/e6630dfbbb3d9cbaa2856f8ce81c9958e9f26593.jpeg)

I am using same principle to load date into this node. What's interesting, I get correct time and date as output of this node, just it's not shown in gui.

Is this bug or not possible to do? Sharing flow I am using.

```auto
[{ "disabled" : false, "env" : [], "id" : "6a07369735a2c313", "info" : "", "label" : "Flow 1", "type" : "tab" }, { "finalize" : "", "func" : "msg = { payload: new Date('2015-03-25') };\nreturn msg;\n", "id" : "e4918f5f7fb0f29d", "initialize" : "", "libs" : [], "name" : "insert time", "noerr" : 0, "outputs" : 1, "type" : "function", "wires" : [[ "89be3210cf95b107"] ], "x" : 270, "y" : 160, "z" : "6a07369735a2c313" }, { "events" : "change", "id" : "b6de6bbbf69d167b", "name" : "", "type" : "ui_ui_control", "wires" : [[ "e4918f5f7fb0f29d"] ], "x" : 100, "y" : 100, "z" : "6a07369735a2c313" }, { "active" : false, "complete" : "payload", "console" : false, "id" : "83148cc35f7dca57", "name" : "", "statusType" : "auto", "statusVal" : "", "targetType" : "msg", "tosidebar" : true, "tostatus" : false, "type" : "debug", "wires" : [], "x" : 590, "y" : 60, "z" : "6a07369735a2c313" }, { "className" : "", "delay" : 300, "group" : "afdd5870dddac354", "height" : 0, "id" : "89be3210cf95b107", "label" : "Start Time", "mode" : "datetime-local", "name" : "", "order" : 2, "passthru" : true, "sendOnBlur" : true, "tooltip" : "", "topic" : "", "topicType" : "str", "type" : "ui_text_input", "width" : 0, "wires" : [[ "83148cc35f7dca57"] ], "x" : 510, "y" : 160, "z" : "6a07369735a2c313" }, { "className" : "", "collapse" : false, "disp" : true, "id" : "afdd5870dddac354", "name" : "test", "order" : 1, "tab" : "f9d9dee5b5dc26ae", "type" : "ui_group", "width" : "6" }, { "icon" : "dashboard", "id" : "f9d9dee5b5dc26ae", "name" : "Tab 5", "order" : 5, "type" : "ui_tab" } ]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [21 February 2022 23:25 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/2 "2022-02-21T23:25:44Z")

</div>

Your example function outputs a time object which is 00:00:00.000 hours,mins,secs and milliseconds. This is because you have no time set in the new date. The time picker text input needs to be feed a time object with time elements or a integer in milliseconds, anything over 24hours is ignored.

so your function sets the time picker to midnight exactly 00:00:00.000

---

<div class="post-metadata">

**Author:** ![garson](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@garson](https://discourse.nodered.org/u/garson)\
**Post date:** [22 February 2022 00:08 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/3 "2022-02-22T00:08:26Z")

</div>

It's datetime picker not time picker.  
I've just changed function and put:  
new Date()  
And I've attached debug to output of text input node and got this:

```auto
22/02/2022, 00:06:16 node: 83148cc35f7dca57
msg.payload : Date

"Tue Feb 22 2022 00:06:15 GMT+0000 (Greenwich Mean Time)"

```

Looks like correct time and date to me.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [22 February 2022 00:44 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/4 "2022-02-22T00:44:35Z")

</div>

Ah, that's a new addition. Just updated dashboard, seem you are unable to prepopulate the field,

---

<div class="post-metadata">

**Author:** ![garson](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@garson](https://discourse.nodered.org/u/garson)\
**Post date:** [22 February 2022 01:16 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/5 "2022-02-22T01:16:22Z")

</div>

Correct. So for time picker mode prepopulate works fine, but not for datetime picker mode.

---

<div class="post-metadata">

**Author:** ![garson](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@garson](https://discourse.nodered.org/u/garson)\
**Post date:** [22 February 2022 13:10 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/6 "2022-02-22T13:10:56Z")

</div>

@E1cid If I understood this correctly, this will be fixed in one of next updates?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [22 February 2022 13:23 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/7 "2022-02-22T13:23:23Z")

</div>

You would have to raise an issue/request on the github page. so the maintainer knows of the issue.

---

<div class="post-metadata">

**Author:** ![garson](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@garson](https://discourse.nodered.org/u/garson)\
**Post date:** [22 February 2022 14:16 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/8 "2022-02-22T14:16:15Z")

</div>

Thanks I will do that.  
Is this node-red or node-red-dashboard? I guess node-red-dashboard.

---

<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:** [22 February 2022 14:17 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/9 "2022-02-22T14:17:52Z")

</div>

> [@garson](#):
>
> I guess node-red-dashboard

Yes, node-red-dashboard 👍

---

<div class="post-metadata">

**Author:** ![garson](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@garson](https://discourse.nodered.org/u/garson)\
**Post date:** [22 February 2022 15:08 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/10 "2022-02-22T15:08:31Z")

</div>

Issue opened on the github page.

---

<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:** [24 March 2022 15:08 UTC](https://discourse.nodered.org/t/pre-fill-datetime-picker-text-input-node-doesnt-show-date-and-time/58771/11 "2022-03-24T15:08:36Z")

</div>

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