Skip to content

Commit

Permalink
fix(date-picker): per review - use dateAllowed helper function instea…
Browse files Browse the repository at this point in the history
…d of dupe logic
  • Loading branch information
dethell committed Nov 16, 2023
1 parent 1dd26c8 commit 1010d3c
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { addListener, setTouchAction } from '@vaadin/component-base/src/gestures
import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
import { dateAfterXMonths, dateEquals, extractDateParts, getClosestDate } from './vaadin-date-picker-helper.js';
import { dateAllowed } from './vaadin-date-picker-helper.js';

/**
* @polymerMixin
Expand Down Expand Up @@ -1029,12 +1030,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>

/** @private */
_dateAllowed(date, min = this.minDate, max = this.maxDate, isDateDisabled = this.isDateDisabled) {
let dateIsDisabled = false;
if (typeof isDateDisabled === 'function' && !!date) {
const dateToCheck = extractDateParts(date);
dateIsDisabled = isDateDisabled(dateToCheck);
}
return (!min || date >= min) && (!max || date <= max) && !dateIsDisabled;
return dateAllowed(date, min, max, isDateDisabled);
}

/** @private */
Expand Down

0 comments on commit 1010d3c

Please sign in to comment.