I wish to populate the value of booking end date based on the value entered by user in the booking start date.
Currently, I am using below codes -
/*-------------------------------------------------------------------------------
Input field 1 : Booking Start Date
-------------------------------------------------------------------------------*/
var bookStartDateTimePicker = CardService.newDatePicker()
.setTitle("Booking Start Date")
.setFieldName("booking_start_date")
.setValueInMsSinceEpoch(tomorrow.getTime())
.setOnChangeAction(CardService.newAction().setFunctionName("dateStartCheck"));
/*-------------------------------------------------------------------------------
Input field 2 : Booking End Date
-------------------------------------------------------------------------------*/
var bookEndDateTimePicker = CardService.newDatePicker()
.setTitle("Booking End Date")
.setFieldName("booking_end_date")
.setValueInMsSinceEpoch(tomorrow.getTime())
.setOnChangeAction(CardService.newAction().setFunctionName("dateEndCheck"));
You need to update the card within your
setOnChangeAction
functionevent object
within your action handler function, you will see the nested structure as following (this is for Gmail, slightly different for Calendar):Sample for updating the end date based on user's input for the start date: