From a8e400da03de1fad3a43f2e76e93f910459a4db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 31 May 2022 14:54:20 +0300 Subject: [PATCH] Update Calendar.vue --- src/components/calendar/Calendar.vue | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/calendar/Calendar.vue b/src/components/calendar/Calendar.vue index dc985ce3e..da7037aea 100755 --- a/src/components/calendar/Calendar.vue +++ b/src/components/calendar/Calendar.vue @@ -440,7 +440,7 @@ export default { return selected; } - else if( this.isRangeSelection()) { + else if (this.isRangeSelection()) { if (this.modelValue[1]) return this.isDateEquals(this.modelValue[0], dateMeta) || this.isDateEquals(this.modelValue[1], dateMeta) || this.isDateBetween(this.modelValue[0], this.modelValue[1], dateMeta); else { @@ -1706,9 +1706,10 @@ export default { } date = this.daylightSavingAdjust(new Date(year, month - 1, day)); - if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { - throw "Invalid date"; // E.g. 31/02/00 - } + + if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { + throw "Invalid date"; // E.g. 31/02/00 + } return date; }, @@ -2193,7 +2194,7 @@ export default { this.focused = false; this.input.value = this.formatValue(this.modelValue); }, - onKeyDown() { + onKeyDown(event) { if (event.keyCode === 40 && this.overlay) { this.trapFocus(event); } @@ -2290,21 +2291,26 @@ export default { if (propValue && Array.isArray(propValue)) { if (this.isRangeSelection()) { propValue = propValue[1] || propValue[0]; - } else if (this.isMultipleSelection()) { + } + else if (this.isMultipleSelection()) { propValue = propValue[propValue.length - 1]; } } if (propValue && typeof propValue !== 'string') { return propValue; - } else { + } + else { let today = new Date(); + if (this.maxDate && this.maxDate < today) { return this.maxDate; } + if (this.minDate && this.minDate > today) { return this.minDate; } + return today; } },