timepicker-ui
4.6.0GitHub
timepicker-ui
Advanced / Dynamic Options

Dynamic Options

Change options of a live picker with setOptions(). This page documents @pglejzer/datepicker-ui, the companion of timepicker-ui.

setOptions()

#

picker.setOptions(patch) merges a partial options object into the current options and applies it, then emits update. Use the buttons to change the theme, the selection mode and the number of months, and open the picker to see the result.

setOptions
Theme
Mode
Months
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
const picker = new DatepickerUI("#date");
picker.create();
picker.setOptions({ ui: { theme: "crane" } });
picker.setOptions({ calendar: { mode: "range" } });
picker.setOptions({ calendar: { months: 2 } });

Note

Changing calendar.mode with setOptions() empties the selection. The width for calendar.months is read when the picker opens and on setOptions().
Esc