timepicker-ui
4.6.0GitHub
timepicker-ui
Selection / Range Limits

Range Length Limits

Bound how many days a date range may span with @pglejzer/datepicker-ui.

Minimum and maximum length

#

calendar.range.minLength and maxLength bound a range in days, with both ends counted. Here a range must cover 3 to 14 days. A typed range that breaks the limits shows labels.invalidRange.

3 to 14 days
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#dates", {
calendar: {
mode: "range",
range: { minLength: 3, maxLength: 14 },
},
}).create();

Future dates only

#

The limits combine with the other calendar rules. Adding minDate: "today" keeps past days out of the range as well.

3 to 14 days from today
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#dates", {
calendar: {
mode: "range",
minDate: "today",
range: { minLength: 3, maxLength: 14 },
},
}).create();

Docs: Selection Modes · Disabled Dates · Options

Esc