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 Apr 22, 2023
1 parent 7f74ca5 commit 2dfa6f6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/js/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,14 @@ export default class Validation {
// because the other validation on the target has already occurred.
if (dates.length !== 2 && index !== 1) return true;

// initialize start date
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
const start = dates[0].clone.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 2dfa6f6

Please sign in to comment.