Skip to main content

setValue()

sets value for a TimePicker

setValue(value: Date | number | string | any[] | ITimeObject): void;

Parameters:

value: Date | number | string | array | object - the value to be set for a timepicker

Example

// set the value as a string
timepicker.setValue("00:39");

// set the value as a Date
timepicker.setValue(new Date('January 10, 2019 17:54:00'));

// set the value as an array
timepicker.setValue([6,20,"AM"]);

// set the value as a number
timepicker.setValue(1559288966422);

// set the value as an object
timepicker.setValue({hour: 10, minute: 50, AM: true});

Related sample: Timepicker. Set Timepicker Value

The value of timepicker set as an array should have the following elements:

  • the hour value
  • the minutes value
  • the "AM/PM" identifier for 12-hour format as a string

The date set as a number is the number of milliseconds since January 1, 1970, 00:00:00 UTC returned by the getTime() method of the Date object.