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.

DR01 Min and Max Dates

Set date range boundaries

Live Demo

Only dates in 2025 are selectable

Code Examples
HTML
 
JavaScript
 
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.

DR02 Disabled Weekdays

Disable specific days of the week

Live Demo

Weekends (Saturday and Sunday) are disabled

Code Examples
HTML
 
JavaScript
 
Details
Weekday Numbers
  • 0 - Sunday
  • 1 - Monday
  • 2 - Tuesday
  • 3 - Wednesday
  • 4 - Thursday
  • 5 - Friday
  • 6 - Saturday
Common Patterns
  • 0,6 - Weekends disabled (weekdays only)
  • 1,2,3,4,5 - Weekdays disabled (weekends only)
  • 0 - Sundays disabled
  • 6 - Saturdays disabled
Note

Web component attribute uses comma-separated string. JavaScript API uses array of numbers.

DR03 Disabled Dates (Specific Dates)

Disable a list of specific dates

Live Demo

5th, 15th, and 25th of current month are disabled

Code Examples
HTML + JavaScript
 
JavaScript
 
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.

DR04 Custom Disable Logic (Callback)

Use functions for complex or dynamic rules

Live Demo

Weekends + every 3rd day of month disabled via callback

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
JavaScript API
 
Web Component
 
Details
Function Signature

getDateMetadataCallback: (date: Date) => DateInfo | null

  • Receives: Date object for the cell being rendered
  • Returns: Object with isDisabled: true to disable, or {} / null to 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.

DR05 Advanced: Date Metadata Callback

Disable dates AND provide styling via single callback

Live Demo

7, 14, 21, 28 Fully booked (disabled)
5, 10, 15... Limited availability (with badge)

Why Use getDateMetadataCallback?

When you need to BOTH disable dates AND apply custom styling/tooltips in one callback.

Single Source of Truth

One callback provides all date metadata:

  • Disabled state
  • Custom CSS classes
  • Tooltips
  • Badges
Code Examples
Hotel Availability Example
 
Multi-State Booking
 
Details
Return Type: DateInfo

The callback returns a DateInfo object with these optional properties:

  • isDisabled: boolean - Disable this date
  • badgeText: string - Text in badge row
  • badgeClass: string - CSS class for badge
  • badgeTooltip: string - Tooltip on badge hover
  • dayClass: string - CSS class for day cell
  • dayTooltip: string - Tooltip on day hover
Advantages vs Separate Options
ApproachProsCons
getDateMetadataCallbackSimple, focusedSeparate from styling
specialDatesStatic dataNot dynamic
getDateMetadataSingle source, dynamicSlightly more complex
Performance

Called once per visible date cell, just like getDateMetadataCallback. Keep logic efficient.

DR06 Combining Multiple Restrictions

How different restriction methods interact

Live Demo

Combined restrictions:
minDate: Today onwards
disabledWeekdays: Sat/Sun
disabledDates: 1st, 11th, 21st
callback: Every 9th day (9, 18, 27)

Restriction Evaluation

A date is disabled if ANY restriction applies:

  1. Date is before minDate
  2. Date is after maxDate
  3. Day of week is in disabledWeekdays
  4. Date is in disabledDates array
  5. getDateMetadataCallback(date).isDisabled is true
Example
All Restrictions Combined
 
Details
Strategy
  • Use minDate/maxDate for hard boundaries
  • Use disabledWeekdays for day-of-week patterns
  • Use disabledDates for fixed lists (holidays, blackout dates)
  • Use getDateMetadataCallback for complex or dynamic logic
  • Use getDateMetadata when 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
MethodBest For
minDate/maxDateDate range boundaries
disabledWeekdaysWeekly patterns
disabledDatesFixed list of dates
getDateMetadataCallbackComplex logic
getDateMetadataDisable + 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) => {...}