setFieldValue for date field

I’m calling setFieldValue to set a field that is a date in the underlying collection. No matter what format I use, the entry is set but with an error " The value does not match the field type Date and Time."

I’ve tried strings, numbers … all flavors of Date() values to no avail.

Is there a working example of setFieldValue for a Date and Time field?



You can do it using a variable, something like this:

var dateExample = new Date("2019-01-02");

$w.onReady(() => {
  $w("#dataset1").onReady(() => {
    $w("#dataset1").setFieldValue("timeField", dateExample);



#dataset1 - ID of the dataset in question, that you can find in the Properties Panel (Velo: Working with the Properties & Events Panel | Help Center |
timeField - Field key of the relevant field.