I can;'t seem to set the value of a date range picker…i.e. on form reset change the value…or on button click change the value.
In the UI it does not have that option:
In the code i’ve tried a variety of different options/syntax to try and set the value or even start/end values but nothing has worked.
Am i missing something here?
Seems a decent size bug if you can’t dynamically set the value of a date range input, especially because resetting a form only resets the visual date and not the value in the actual input.
Have you tried dmx bindings under Dynamic Attributes -> Date Picker -> Start Date & End Date options to set default values? I added the Date Range Picker input field and Date and Time component on the page for the code below. The code displays a range between current date and current date + 7 days.
You’re right, there’s no direct method to set the date values in the date range picker on another dynamic event.
An alternative I have found is to setup two variable. On the button click, set values for these variables: say current time for var1 and current time + 1 day for var2 and then bind these var values to the date range picker input. I’m sure there will be other ways to achieve this as well.
Just had a use case for this, and was able to make it work.
The picker still doesn’t show the option to set value (as of 5.8.2), but you can do it via code.
The syntax is to provide both start and end dates, comma separated - in the setValue function.