diff --git a/src/components/datepicker/bl-datepicker.stories.mdx b/src/components/datepicker/bl-datepicker.stories.mdx
index 126f18f3..272740db 100644
--- a/src/components/datepicker/bl-datepicker.stories.mdx
+++ b/src/components/datepicker/bl-datepicker.stories.mdx
@@ -134,6 +134,24 @@ You can set input width of datepicker as you wish.
+
+### Min - Max Date
+
+You can set min date or max date for the datepicker.
+
+
+
## Reference
diff --git a/src/mixins/datepicker-calendar-mixin/datepicker-calendar-mixin.ts b/src/mixins/datepicker-calendar-mixin/datepicker-calendar-mixin.ts
index f7dc5e1b..6defd4ac 100644
--- a/src/mixins/datepicker-calendar-mixin/datepicker-calendar-mixin.ts
+++ b/src/mixins/datepicker-calendar-mixin/datepicker-calendar-mixin.ts
@@ -64,10 +64,15 @@ export default class DatepickerCalendarMixin extends LitElement {
@property({ type: Date, attribute: "max-date", reflect: true })
set maxDate(maxDate: Date) {
+ if (isNaN(new Date(maxDate).getTime())) {
+ console.warn("Invalid maxDate value.");
+ return;
+ }
if (this._minDate && this._minDate >= maxDate) {
console.warn("maxDate cannot be smaller than minDate.");
} else {
- this._maxDate = maxDate;
+ this._maxDate = new Date(maxDate);
+ this.requestUpdate("maxDate", maxDate);
}
}
@@ -82,10 +87,15 @@ export default class DatepickerCalendarMixin extends LitElement {
@property({ type: Date, attribute: "min-date", reflect: true })
set minDate(minDate: Date) {
+ if (isNaN(new Date(minDate).getTime())) {
+ console.warn("Invalid minDate value.");
+ return;
+ }
if (this._maxDate && this._maxDate <= minDate) {
console.warn("minDate cannot be greater than maxDate.");
} else {
- this._minDate = minDate;
+ this._minDate = new Date(minDate);
+ this.requestUpdate("minDate", minDate);
}
}