From 8954cbeb75752bb639fecb90f504efd83e8a503a Mon Sep 17 00:00:00 2001 From: vasileios Date: Mon, 18 Dec 2023 17:23:39 +0100 Subject: [PATCH] [open-formulieren/open-forms#3671] Fixed max date validation when current included --- src/formio/validators/minMaxDateValidator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/formio/validators/minMaxDateValidator.js b/src/formio/validators/minMaxDateValidator.js index 65ae2ad2c..24af66fb9 100644 --- a/src/formio/validators/minMaxDateValidator.js +++ b/src/formio/validators/minMaxDateValidator.js @@ -1,3 +1,4 @@ +import {parseISO} from 'date-fns'; import set from 'lodash/set'; const validateDateBoundaries = (minBoundary, maxBoundary, value) => { @@ -8,7 +9,7 @@ const validateDateBoundaries = (minBoundary, maxBoundary, value) => { return {isValid: true}; } - const parsedValue = new Date(value); + const parsedValue = parseISO(value, 'yyyy-MM-dd', new Date()); if (minDate && maxDate) { const isValid = parsedValue >= minDate && parsedValue <= maxDate;