Restrict date selection using min/max dates, disable specific weekdays, blacklist specific dates, or use custom logic for complex business rules.
Multiple restriction methods can be combined. The date picker evaluates all restrictions together to determine if a date is selectable.
Min and Max Dates
Set date range boundaries
Live Demo
Only dates in 2025 are selectable
Code Examples
Details
Use Cases
- Future only - Bookings that can't be in the past
- Date range limits - Restrict to specific year or quarter
- Business constraints - Only allow dates within fiscal year
- Age verification - Max date 18 years ago
Format
Dates can be specified as:
- String:
"YYYY-MM-DD"ISO format - Date object:
new Date(2025, 0, 1)
Behavior
Dates outside the min/max range are grayed out and cannot be selected. Navigation buttons are disabled when reaching boundaries.
Disabled Weekdays
Disable specific days of the week
Live Demo
Weekends (Saturday and Sunday) are disabled
Code Examples
Details
Weekday Numbers
0- Sunday1- Monday2- Tuesday3- Wednesday4- Thursday5- Friday6- Saturday
Common Patterns
0,6- Weekends disabled (weekdays only)1,2,3,4,5- Weekdays disabled (weekends only)0- Sundays disabled6- Saturdays disabled
Note
Web component attribute uses comma-separated string. JavaScript API uses array of numbers.
Disabled Dates (Specific Dates)
Disable a list of specific dates
Live Demo
New Year and Christmas holidays are disabled
Code Examples
Details
When to Use
Use disabledDates array when you have a fixed list of specific dates to disable:
- Company holidays
- Maintenance dates
- Already booked dates
- Blackout dates
Format
- Array of ISO date strings:
['2025-01-01', '2025-12-25'] - Array of Date objects:
[new Date(2025, 0, 1), ...]
No Attribute Support
Due to limitations of web component attributes (can't pass arrays), you must set disabledDates via JavaScript property.
Performance
Efficient for moderate lists (100s of dates). For larger datasets or complex logic, use getDateMetadataCallback callback instead.
Custom Disable Logic (Callback)
Use functions for complex or dynamic rules
When to Use
Use Callback When:
- Complex logic - Multiple conditions, date ranges, calculations
- Dynamic data - Rules change based on other selections
- Large datasets - Thousands of disabled dates (compute on-the-fly)
- Date ranges - Disable ranges instead of individual dates
Use Array When:
- Simple list - Fixed set of specific dates
- Small dataset - Hundreds of dates or fewer
- Static data - Holidays that don't change
Code Examples
Details
Function Signature
getDateMetadataCallback: (date: Date) => boolean
- Receives: Date object for the cell being rendered
- Returns:
trueto disable,falseto enable
Usage Patterns
JavaScript API: Pass getDateMetadataCallback in options during new DateRangePicker()
Web Component: Can also be set as a property on the element (picker.getDateMetadataCallback = ...)
Performance
Called once per visible date cell (~35-42 times per month view). Keep logic efficient. Avoid heavy computations or async operations.
Combining with Other Restrictions
The callback is evaluated in addition to min/max dates, disabled weekdays, and disabled dates array. A date is disabled if ANY restriction applies.
Advanced: Date Metadata Callback
Disable dates AND provide styling via single callback
Use Case
Why Use getDateMetadata?
When you need to BOTH disable dates AND apply custom styling/tooltips, use getDateMetadata instead of separate getDateMetadataCallback and specialDates.
Single Source of Truth
One callback provides all date metadata:
- Disabled state
- Custom CSS classes
- Tooltips
- Badges
Example Scenario
Hotel booking system:
- Fully booked dates → Disabled + red styling + "Fully booked" tooltip
- Limited availability → Enabled + orange styling + "2 rooms left" tooltip
- Available dates → Enabled + default styling
Code Examples
Details
Return Type: DateInfo
The callback returns a DateInfo object with these optional properties:
isDisabled: boolean - Disable this datebadgeText: string - Text in badge rowbadgeClass: string - CSS class for badgebadgeTooltip: string - Tooltip on badge hoverdayClass: string - CSS class for day celldayTooltip: string - Tooltip on day hover
Advantages vs Separate Options
| Approach | Pros | Cons |
|---|---|---|
getDateMetadataCallback | Simple, focused | Separate from styling |
specialDates | Static data | Not dynamic |
getDateMetadata | Single source, dynamic | Slightly more complex |
Performance
Called once per visible date cell, just like getDateMetadataCallback. Keep logic efficient.
Combining Multiple Restrictions
How different restriction methods interact
Evaluation Order
Restriction Evaluation
A date is disabled if ANY of these conditions are true:
- Date is before
minDate - Date is after
maxDate - Day of week is in
disabledWeekdays - Date is in
disabledDatesarray getDateMetadataCallback(date)returns truegetDateMetadata(date).isDisabledis true
All Restrictions Are Additive
If you set multiple restrictions, they ALL apply. You cannot "override" one with another.
Example
Details
Strategy
- Use
minDate/maxDatefor hard boundaries - Use
disabledWeekdaysfor day-of-week patterns - Use
disabledDatesfor fixed lists (holidays, blackout dates) - Use
getDateMetadataCallbackfor complex or dynamic logic - Use
getDateMetadatawhen you need styling + disabling
Performance Consideration
Evaluation happens in order listed above (min/max checked first). The picker short-circuits as soon as ANY condition is true.
Debugging
Enable debug logging to see why dates are disabled:
window.components['web-daterangepicker'].logging.enableLogging();Quick Reference
Restriction Methods
| Method | Best For |
|---|---|
minDate/maxDate | Date range boundaries |
disabledWeekdays | Weekly patterns |
disabledDates | Fixed list of dates |
getDateMetadataCallback | Complex logic |
getDateMetadata | Disable + styling |
Common Patterns
- Future only -
minDate: new Date() - Weekdays only -
disabledWeekdays: [0, 6] - This year -
minDate: '2025-01-01', maxDate: '2025-12-31' - Holidays -
disabledDates: [...] - Bookings -
getDateMetadataCallback: (date) => {...}