Open gfinleyg opened 3 weeks ago
The node's behavior is broken with this setup too, if you try to change any of the date/time fields or select using the calendar, it goes back to a blank value as soon as you mouse-hover over the field again.
@gfinleyg
Indeed when I inject 1728932496400 as payload, it doesn't appear in the datetimepicker. And in my developer tools console log, I see this error:
The specified value "1729797008798" does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS".
I could change the code to fix it, but would like to hear first the core devs their opinion whether that is desired behaviour.
I also can confirm that the selected datetime disappears in Firefox on my Windows 10 portable. For Chrome and Edge this problem does not occur. I don't see any errors in the Firefox console log.
I was trying it with a numerical value of 1728932496400, it's good to note that the string "1728932496400" doesn't work either.
I also tried a few of the Javascript "new Date()" formats, with no luck.
It looks like using the format that you saw in the dev tools console log works and doesn't leave the tool broken in Firefox. It appears that the .toISOString() function would get that output, but none of the other formats will work out of the box and .toISOString() isn't available in my instance of Node-Red for function nodes.
I think the idea is that you have to feed it with a value in the same format as the output. If you want it to take a js timestamp then it has to know which timezone you want, which can be problematic. As it is, it is timezone agnostic. D1 is a bit of a mess with time/date pickers because of this. Edit: A mess because it tries to allow for timezone.
@colinl That makes sense, but it isn't returned in that format and there isn't any documentation of how it should work in https://dashboard.flowfuse.com/nodes/widgets/ui-text-input.html. A working datetime output looks like: 12/01/2024, 01:01 AM not "yyyy-MM-ddThh:mm"
I'm not sure where to get access to the developer tools console log mentioned earlier, so I had no idea that was the format required for this to work.
I figured the varying format possibilities could be a problem which was why I started with the numerical ms since the beginning of the Epoch input.
but it isn't returned in that format
It is for me.
Fair, I was looking at the output on the dashboard rather than a debug node. I suppose not using the ms since the beginning of the epoch also allows usage of dates before 1970 which could have some use-cases.
Looks like you can use negative numbers to set dates prior to 1970, so that last statement isn't as important.
Current Behavior
Inputs to a Text Input node that is set to datetime picker aren't displayed.
Expected Behavior
Passing a valid JavaScript Date number should change the date and time set in the field.
Steps To Reproduce
Attach a function block outputting msg.payload = 1728932496400 to the input of a Text Input node with it's mode set to datetime picker.
Environment
Have you provided an initial effort estimate for this issue?
I am not a FlowFuse team member