@@ -13,7 +13,7 @@ import EventHandler from './dom/event-handler.js'
1313import Manipulator from './dom/manipulator.js'
1414import SelectorEngine from './dom/selector-engine.js'
1515import { defineJQueryPlugin , getElement , isRTL } from './util/index.js'
16- import { convertToDateObject } from './util/calendar.js'
16+ import { convertToDateObject , isDateDisabled } from './util/calendar.js'
1717import { getLocalDateFromString } from './util/date-range-picker.js'
1818
1919/**
@@ -370,6 +370,11 @@ class DateRangePicker extends BaseComponent {
370370
371371 // valid date or empty date
372372 if ( ( date instanceof Date && ! Number . isNaN ( date ) ) || ( date === null ) ) {
373+ // Check if the date is disabled
374+ if ( date && isDateDisabled ( date , this . _config . minDate , this . _config . maxDate , this . _config . disabledDates ) ) {
375+ return // Don't update if date is disabled
376+ }
377+
373378 this . _startDate = date
374379 this . _calendarDate = date
375380 this . _calendar . update ( this . _getCalendarConfig ( ) )
@@ -418,6 +423,11 @@ class DateRangePicker extends BaseComponent {
418423
419424 // valid date or empty date
420425 if ( ( date instanceof Date && ! Number . isNaN ( date ) ) || ( date === null ) ) {
426+ // Check if the date is disabled
427+ if ( date && isDateDisabled ( date , this . _config . minDate , this . _config . maxDate , this . _config . disabledDates ) ) {
428+ return // Don't update if date is disabled
429+ }
430+
421431 this . _endDate = date
422432 this . _calendarDate = date
423433 this . _calendar . update ( this . _getCalendarConfig ( ) )
0 commit comments