-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text Input node set for 'datetime picker' with a value passed to the input node breaks the picker #1409
Comments
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. |
|
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. |
@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: 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. |
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. |
They are if you send a well formatted date / time / datetime See the "Try Demo" link in the docs: https://dashboard.flowfuse.com/nodes/widgets/ui-text-input.html Related: https://discourse.nodered.org/t/default-values-in-text-input/93073 @joepavitt we may wish to relax this as it took me too long to determine the correct format. We should take anything that "looks like a date/time/datetime" and use it. As it stands, sending |
Be very careful here, I suggest not allowing anything where timezones may come into play, otherwise we will end up in the same mess as with D1. Currently the input has to be in the same form as the output, which is TZ agnostic and there is no confusion about what it means. That means, I think, that milliseconds, date/time with timezone specified, etc should not be allowed. |
@colinl Using milliseconds is setting it based on unix time which is always tied to UTC. There's no time zone to worry about with it. |
Suppose I have an Inject node configured to send the current time in milliseconds, feeding into the datetime picker node. If I look at my watch and it says 12:00 and I click the Inject node, what time would you expect it to set the picker to? |
@colinl That would be whatever difference you have between your Time Zone at 12:00 and UTC. When I said you don't need to worry about time zones I meant as far as parsing the input. If a developer is planning to use unix time as an input I would expect them to understand how that works. |
Remember that node-red is aimed at users that are not software developers. The inject node sends the current time, but if you feed that into the datetime node it would generally not display what the user considers to be the current time. Such issues cause endless confusion. |
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
The text was updated successfully, but these errors were encountered: