[SOLVED] How to set date/time picker to current date time

I’ve got a form with a date/time picker.
I want it to automatically populate with the current date/time so that the user doesn’t have to manually select it.
If they leave the page open for a while the date/time picker doesn’t update to the NEW current date/time.

How can I get the date/time picker to update to the current, as of this moment, date/time (not the date/time when the page was loaded)?

I tried using a condition, so when the dropdown is pressed the date/time is reset, but that’s not actually changing anything.

I tried using a workflow to set a custom state, but I don’t see anywhere to tell the date/time picker to update itself when that custom state changes

I tried to reset the data in the date/time input but it gets reset back to what WAS the current time when the page was loaded.

I tried to “display data” but the date/time input doesn’t show up in the list.
The date/time input also doesn’t have a “data source” I can change (like the repeating group does).

Add a custom state of type Date to the date time picker and set the Initial Value of the date time picker to the custom state.

On the workflow add a Do Every 1 Seconds to set the value of the custom state to “Current Date/Time”.

You might need to add a couple of other things so that if the user does choose a value manually, it stops auto updating.

See my demo in the run mode here:


and in the editor:

2 Likes

Got it.

  • DateInput A (or whatever you want to call it)
  • set DateInput A’s initial content to “current date/time”
  • set a custom state in the DateInput (something like curr_date_time)
  • set a condition in DateInput A, when it’s own custom state is not empty it’s initial content is set to its custom state, so it should read like “this DateInput’s curr_date_time is not empty” and set the “initial content” to “this DateInput’s curr_date_time”
  • make a workflow with at least two actions; the first action will set the custom state curr_date_time to the “current date/time” and the SECOND action will reset the DateInput

So it’s like the dropdown changing updates the date/time in the custom state, then the condition updates the initial content to reflect the custom state, then the reset changes the DateInput’s value “back” to its initial condition.

It’s a silly work around, but the emphasis is on “works”.

Glad you got it working, I think my attempt is a wee bit less hacky and fewer steps and possibly a touch simpler.

So you got the DateInput to change it’s value just by setting its initial content to its custom state and then changing the value of the custom state itself? I could have sworn that changing the custom state wasn’t working for me. Maybe I didn’t try it in that exact combination. The custom state’s value would change, but the value displayed in the DateInput wouldn’t change.

1 Like

That’s right, if you open my live demo page, you can see it updating with each minute. (you did change the default interval from 30 to 1, didn’t you…)

1 Like

Sorry for bumping such an old thread, but the discussions in here solved a huge problem for. Just wanted to reach out and say thanks @DaveA and @blueback09 :heart_eyes:

1 Like

This did wonders for my use case. Thank you