Search.../

value

Sets or gets the value of the date picker.

Description

Setting the value property sets the date displayed in the date picker element.

Notes:

  • Changing a date picker's value in code doesn't trigger an onChange event.

  • If a date picker is connected to a dataset, setting the date picker's value in code doesn't set the value of the connected field in the dataset. That means if you use the dataset to perform a submit, the value changed in code isn't reflected in the submitted item.

  • To submit the new value using a dataset, set the field's value using the setFieldValue() function before performing the submit.

Type:

DateRead & Write

Was this helpful?

Get a date picker's date value

Copy Code
1let date = $w("#myDatePicker").value;
2
3let valStr = date.toDateString(); // "Fri Jan 13 2017"
Set a date picker's date value to be today

Copy Code
1$w("#myDatePicker").value = new Date();