value
Optional. The time value to be set on initialization of the timepicker
value?: Date | number | string | any[] | object;
Example
// the value as a Date object
const timepicker = new dhx.Timepicker("timepicker_container", {
value: new Date()
});
// the value as a number
const timepicker = new dhx.Timepicker("timepicker_container", {
value: 1232151545
});
// the value as a string
const timepicker = new dhx.Timepicker("timepicker_container", {
value: "22:30"
});
// the value as an array
const timepicker = new dhx.Timepicker("timepicker_container", {
value: [6,20,"AM"]
});
// the value as an object
const timepicker = new dhx.Timepicker("timepicker_container", {
value: {hour: 10, minute: 50, AM: true}
});
Related sample: Timepicker. Initialization with button
1. 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
2. The value set as an object:
- for the 24-hour format contains
key: value
pairs for hours, minutes and their values:{hour: 0, minute: 39}
- for the 12-hour format contains
key: value
pairs for hours, minutes, am/pm identifiers and their values:{hour: 6, minute: 0, AM: true}
3. 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.
Change log:
added in v7.0