The select() method selects the specified date in the Navigator date picker component.
Declaration
Automatic selection:
DayPilot.Navigator.select(date[, options])Free-hand selection (available since 2022.2.5270):
DayPilot.Navigator.select(start, end[, options])Parameters
date(DayPilot.Date or ISO 8601 string) - date to be selectedstart(DayPilot.Date or ISO 8601 string) - selection start dateend(DayPilot.Date or ISO 8601 string) - selection end dateoptions(object) - custom options object; optional
The options object supports the following properties:
dontFocus(boolean) - set totrueif you do not want the Navigator to autofocus and change the visible range according to the selected datedontNotify(boolean) - set totrueif you do not want DayPilot.Navigator.onTimeRangeSelect and DayPilot.Navigator.onTimeRangeSelected to fire
Notes
The selected date will be extended according to the current DayPilot.Navigator.selectMode.
If you want to specify custom selection
startandenddates, DayPilot.Navigator.freeHandSelectionEnabled must be set totrue.If the new date or range is within the currently visible range, the visible range will be updated.
DayPilot.Navigator.onVisibleRangeChanged fires if it is necessary to update the visible range.
DayPilot.Navigator.onTimeRangeSelected fires if the selection changes.
Example
Select a date using automatic selection:
const nav = new DayPilot.Navigator("dp", {
// ...
});
nav.init();
nav.select("2026-03-15");Select a custom range using free-hand selection:
const nav = new DayPilot.Navigator("dp", {
freeHandSelectionEnabled: true,
// ...
});
nav.init();
nav.select("2026-03-15", "2026-03-18", {
dontNotify: true
});See Also
DayPilot.Navigator.freeHandSelectionEnabled
DayPilot.Navigator.onTimeRangeSelect
DayPilot.Navigator.onTimeRangeSelected
DayPilot.Navigator.onVisibleRangeChanged
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot