Skip to content

Commit

Permalink
Fix meetsAgeRequirements for min/max dates
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisl committed Apr 15, 2023
1 parent 4607dcb commit af3ae13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/ValidationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ function meetsAgeRequirements(date) {
const eighteenYearsAgo = moment().subtract(18, 'years');
const oneHundredFiftyYearsAgo = moment().subtract(150, 'years');
const testDate = moment(date);
return testDate.isValid() && testDate.isBetween(oneHundredFiftyYearsAgo, eighteenYearsAgo);

// Only compare the dates (ignore the time), and make the comparison inclusive of the start and end dates
return testDate.isValid() && testDate.isBetween(oneHundredFiftyYearsAgo, eighteenYearsAgo, 'day', '[]');
}

/**
Expand Down

0 comments on commit af3ae13

Please sign in to comment.