From 71aca39655eb7551b3755f2a62c63df86eebed35 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina" Date: Wed, 2 Oct 2024 16:27:38 -0400 Subject: [PATCH] Add validation moment day --- src/components/FormDatePicker.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/FormDatePicker.vue b/src/components/FormDatePicker.vue index 071610d..8716937 100644 --- a/src/components/FormDatePicker.vue +++ b/src/components/FormDatePicker.vue @@ -254,11 +254,15 @@ export default { @returns {boolean} */ checkMinMaxDateDisabled(date) { + date = moment(date.toLocaleDateString() + ' ' + moment().format('hh:mm:ss a')).toDate(); const minDate = !!this.minDate ? this.parseDateToDate(this.minDate) : ""; const maxDate = !!this.maxDate ? this.parseDateToDate(this.maxDate) : ""; // If minDate and maxDate are not defined, return. This would be the default case if (minDate.length === 0 && maxDate.length === 0) return; if (!!minDate && !!maxDate) { + if (this.config.dataFormat === 'date') { + return !(moment(date).isSameOrAfter(minDate, 'day') && moment(date).isSameOrBefore(this.maxDate, 'day')); + } return !(date >= minDate && date <= maxDate); } // If minDate is defined but maxDate not defined, block the dates before minDate is defined