From 4252969ee993a30c9aadf522edb5ec8d295a8643 Mon Sep 17 00:00:00 2001 From: GitHub User Date: Thu, 20 Apr 2023 20:04:15 +0200 Subject: [PATCH] fixing infinity loop bug in date range (#2798) --- src/js/validation.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js/validation.ts b/src/js/validation.ts index cebababcf..5611a7bcb 100644 --- a/src/js/validation.ts +++ b/src/js/validation.ts @@ -204,12 +204,13 @@ export default class Validation { if (dates.length !== 2 && index !== 1) return true; // initialize start date - const start = dates[0].clone; - // check if start date is not the same as target date - if (start.isSame(target, Unit.date)) return true; + const start = dates[0]; + // check if start date is not the same as target date + if(start.isSame(target, Unit.date)) return true; + // add one day to start; start has already been validated - start.manipulate(1, Unit.date); + start.clone.manipulate(1, Unit.date); // check each date in the range to make sure it's valid while (!start.isSame(target, Unit.date)) {