From 3d0d5eeb5a94715be9c2c4e3867e550a4e433a9c Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Tue, 21 Nov 2023 11:10:14 +0100 Subject: [PATCH] :sparkles: [open-formulieren/open-forms#3612] Make checks inclusive to be consistent with time/number components --- src/formio/validators/minMaxDateValidator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/formio/validators/minMaxDateValidator.js b/src/formio/validators/minMaxDateValidator.js index 5d50364a9..65ae2ad2c 100644 --- a/src/formio/validators/minMaxDateValidator.js +++ b/src/formio/validators/minMaxDateValidator.js @@ -11,13 +11,13 @@ const validateDateBoundaries = (minBoundary, maxBoundary, value) => { const parsedValue = new Date(value); if (minDate && maxDate) { - const isValid = parsedValue >= minDate && parsedValue < maxDate; + const isValid = parsedValue >= minDate && parsedValue <= maxDate; let errorKeys = isValid ? [] : parsedValue < minDate ? ['minDate'] : ['maxDate']; return {isValid, errorKeys}; } if (minDate) return {isValid: parsedValue >= minDate, errorKeys: ['minDate']}; - if (maxDate) return {isValid: parsedValue < maxDate, errorKeys: ['maxDate']}; + if (maxDate) return {isValid: parsedValue <= maxDate, errorKeys: ['maxDate']}; }; const MinMaxDateValidator = {