timepicker-ui
4.6.0GitHub
timepicker-ui
Selection / Multiple Dates

Multiple Dates

Select any number of separate days with @pglejzer/datepicker-ui.

Multiple

#

Set calendar.mode to "multiple". Each click toggles a day. The confirmed value is an array of date values sorted by date.

Multiple
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#dates", {
calendar: { mode: "multiple" },
}).create();

Limit the count and the headline

#

calendar.multiple.max caps how many days can be selected. labels.multipleSelected is the modal headline. It takes a string or an object keyed by Intl.PluralRules categories, and {count} is replaced by the number of selected days. The demo opens as a modal on small windows, where the headline is visible.

Max 3 dates
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#dates", {
calendar: { mode: "multiple", multiple: { max: 3 } },
labels: {
multipleSelected: {
one: "{count} date selected",
other: "{count} dates selected",
},
},
}).create();

Docs: Selection Modes · Options

Esc