Prefill time in form

Hello.

I have a simple form with time. When i enter my time, lets say 04:15 i get the following:
1970-01-01T03:15:00.000Z

My research here revealed that this is normal and is the unix time. There are ways to format the time.
What i am now trying to do is just simply refill the timefield with my entered time (unixtime). When i do so (see flow) my timefield has this wired appearance: 04:14:00:000.

What do i miss?

Thank you

[
    {
        "id": "72b8b15bd5b75057",
        "type": "ui_form",
        "z": "02d1a812d54255d5",
        "name": "",
        "label": "",
        "group": "0c8e5477df738067",
        "order": 2,
        "width": 0,
        "height": 0,
        "options": [
            {
                "label": "time",
                "value": "time",
                "type": "time",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "time": ""
        },
        "payload": "",
        "submit": "submit",
        "cancel": "cancel",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": "",
        "className": "",
        "x": 530,
        "y": 940,
        "wires": [
            [
                "4aee33864945dbc9",
                "a59053bdadb650d1"
            ]
        ]
    },
    {
        "id": "4aee33864945dbc9",
        "type": "debug",
        "z": "02d1a812d54255d5",
        "name": "debug 49",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 940,
        "wires": []
    },
    {
        "id": "a59053bdadb650d1",
        "type": "change",
        "z": "02d1a812d54255d5",
        "name": "save",
        "rules": [
            {
                "t": "set",
                "p": "savetime",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 710,
        "y": 900,
        "wires": [
            []
        ]
    },
    {
        "id": "d4ac591e76f10ecf",
        "type": "function",
        "z": "02d1a812d54255d5",
        "name": "get_time",
        "func": "msg.payload = flow.get(\"savetime\")\nreturn msg;\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 240,
        "y": 940,
        "wires": [
            [
                "30dee64a5789c3c6",
                "1f6899a23f94e7eb"
            ]
        ]
    },
    {
        "id": "30dee64a5789c3c6",
        "type": "function",
        "z": "02d1a812d54255d5",
        "name": "assign_Key_Value",
        "func": "msg.payload = { \n\"time\": msg.payload.time, \n} \nreturn msg; \n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 390,
        "y": 880,
        "wires": [
            [
                "72b8b15bd5b75057"
            ]
        ]
    },
    {
        "id": "74b307874a68f9fb",
        "type": "ui_ui_control",
        "z": "02d1a812d54255d5",
        "name": "",
        "events": "all",
        "x": 80,
        "y": 940,
        "wires": [
            [
                "d4ac591e76f10ecf"
            ]
        ]
    },
    {
        "id": "1f6899a23f94e7eb",
        "type": "debug",
        "z": "02d1a812d54255d5",
        "name": "debug 50",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 400,
        "y": 1020,
        "wires": []
    },
    {
        "id": "0c8e5477df738067",
        "type": "ui_group",
        "name": "Monitoring-Email",
        "tab": "7dfaa34bd3fad2fd",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "7dfaa34bd3fad2fd",
        "type": "ui_tab",
        "name": "SETTINGS",
        "icon": "dashboard",
        "order": 4,
        "disabled": false,
        "hidden": false
    }
]

To refill the form when submitting just feed it back to the input, to prefill the form from saved context on connect or tab change, use a switch to make sure the tab name is correct then reload the saved form data.
e.g.

[{"id":"74b307874a68f9fb","type":"ui_ui_control","z":"65617ffeb779f51c","name":"","events":"all","x":120,"y":3900,"wires":[["ac44d8a5d86e2ec2"]]},{"id":"ac44d8a5d86e2ec2","type":"switch","z":"65617ffeb779f51c","name":"","property":"name","propertyType":"msg","rules":[{"t":"eq","v":"SETTINGS","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":270,"y":3900,"wires":[["6723ad92c82017ae"]]},{"id":"6723ad92c82017ae","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"saveform","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":3900,"wires":[["72b8b15bd5b75057","71784990fb788671"]]},{"id":"72b8b15bd5b75057","type":"ui_form","z":"65617ffeb779f51c","name":"","label":"","group":"0c8e5477df738067","order":2,"width":0,"height":0,"options":[{"label":"time","value":"time","type":"time","required":true,"rows":null}],"formValue":{"time":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":570,"y":3940,"wires":[["4aee33864945dbc9","a59053bdadb650d1"]]},{"id":"71784990fb788671","type":"debug","z":"65617ffeb779f51c","name":"debug 247","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":3840,"wires":[]},{"id":"a59053bdadb650d1","type":"change","z":"65617ffeb779f51c","name":"save","rules":[{"t":"set","p":"saveform","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":3940,"wires":[["72b8b15bd5b75057"]]},{"id":"4aee33864945dbc9","type":"debug","z":"65617ffeb779f51c","name":"debug 49","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":740,"y":3980,"wires":[]},{"id":"0c8e5477df738067","type":"ui_group","name":"Monitoring-Email","tab":"7dfaa34bd3fad2fd","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"7dfaa34bd3fad2fd","type":"ui_tab","name":"SETTINGS","icon":"dashboard","order":4,"disabled":false,"hidden":false}]
1 Like

thank you very much,

your flow is more elegant than mine!

Have you an idea how to get rid of strange pre/refill format of the time 04:15:00.000?

Not seeing the issue, are you running the latest version of dashboard?
Using chrome android.

my dashboard version is 3.4.0.

Interesting. When i am using firefox i get this strange timepattern.

But when i use chrome for example, the time is displayed correct.

thank you

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