Skip to content

Commit

Permalink
fixing infinity loop bug in date range (#2798)
Browse files Browse the repository at this point in the history
  • Loading branch information
T1m3M authored and Eonasdan committed Jul 3, 2023
1 parent 84d162f commit 4252969
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/js/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 4252969

Please sign in to comment.