Search.../

enabledTimes

Sets or gets the time slots that are available for a time picker.

Description

The enabledTimes lets your site members choose from a set of enabled time slots that you defined as available.

Setting the enabledTimes property sets all the time slots available to a timePicker element.

Getting the enabledTimes property returns the current list of time slots available to a timePicker element.

When setting and getting the enabled times, the time slot values are an array of TimeSlot objects. Each time slot object contains a startTime and an endTime.

You cannot modify the enabledTimes array in-place. To add, change, or remove individual time slots:

  1. Store the value of the enabledTimes property in a variable.
  2. Make changes to the variable's array of enabled time slots.
  3. Reset the enabledTimes property with the variable's modified array.

Type:

Array<TimeSlot>Read & Write
NAME
TYPE
DESCRIPTION
startTime
string

Start time for the time slot. The startTime must be earlier than the endTime, and be in one of the following formats:

  • HH:MM (hours and minutes)
  • HH:MM:SS (hours, minutes, and seconds)
  • HH:MM:SS.mmm (hours, minutes, seconds, and milliseconds)

HH is a 2-digit value between 0-23.

MM is a 2-digit value between 0-59.

SS is a 2-digit value between 0-59. Seconds are rounded down to the nearest minute.

mmm is a 3-digit value between 0-999. Milliseconds are rounded down to the nearest second.

The time picker's first input time option is the startTime. This means that if the startTime is '10:00', the first input time option is '10:00'.

endTime
string

End time for the time slot. The endTime must be later than the startTime, and be in one of the following formats:

  • HH:MM (hours and minutes)
  • HH:MM:SS (hours, minutes, and seconds)
  • HH:MM:SS.mmm (hours, minutes, seconds, and milliseconds)

HH is a 2-digit value between 0-23.

Note that '24:00' is a valid endTime in order for '23:59' to be an input time option.

MM is a 2-digit value between 0-59.

SS is a 2-digit value between 0-59. Seconds are rounded down to the nearest minute.

mmm is a 3-digit value between 0-999. Milliseconds are rounded down to the nearest second.

The endTime is not included in the time picker's input time options. This means that if the endTime is '11:00', the time picker's last input time option (assuming step is '1'), is '10:59'.

Was this helpful?

Get the enabled time slots for the time picker

Copy Code
1let availableTimeSlots = $w("#myTimePicker").enabledTimes;
Set the enabled time slots for the time picker

Copy Code
1$w("#myTimePicker").enabledTimes = [
2 {startTime: "13:35", endTime: "14:00"},
3 {startTime: "16:00", endTime: "19:00"},
4];