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

Hello everyone.

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

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

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

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.

[ { "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" } ]

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

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:

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.

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

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

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

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

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

Yes, node-red-dashboard :+1:

Issue opened on the github page.

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