Help with Toggle Switch and DateTime picker

I have been asked to toggle a switch and disable the datetime picker and set the date and time to now() expecting a 1 second refresh. Now if the toggle changes I need enable the datetime picker and set it to the current date and time and let the user pick the date from that.

I´m trying to do a binding to the datetime picker Value with property binding having the state of the toggle and then adding an Expression with the following
if({value}=false, now() , now(0))

the issue is when the toggle is true, the datime picker shows current datentime but still refresh and the user can´t pick a past date, the date and time is selected by the user but it goes back to the current time.

It doesn't seem like a good user experience. I think you should replace the date picker with a label if the Live option is selected. Anyway,

  • On the date picker, create custom.dateTime property.
  • Add an expression binding,
if({../tglLive.props.selected},
	now(5000),		// update every 5 x.
	{this.props.value}
)
  • On props.enabled add the expression binding,
    !{../tglLive.props.selected}

The result will be this and when you toggle Live off the previously selected date will still be there.

Live date

As mentioned, I would replace the picker with a label to show the value of custom.dateTime and enable the display of it and the datetime picker based on the toggle.


Tip: your expression
if({value} = false, now() , now(0))
can be simplified to
if({value}, now(0) , now())
Not that you want to use it anymore.

Thank you so much, I have tested your solution and it works! I will try the label as you mentioned, I appreaciate the last tip.