Skip to content

Commit

Permalink
Fix same-day discharge date selection in DateInputV2 component (#9014)
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidSumra authored Nov 6, 2024
1 parent 4ac3ce9 commit 0f9cc52
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/Common/DateInputV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ const DateInputV2: React.FC<Props> = ({
year = datePickerHeaderDate.getFullYear(),
) => {
const date = new Date(year, month, day);
if (
min &&
max &&
min.getDate() === max.getDate() &&
day === min.getDate() &&
month === min.getMonth() &&
year === min.getFullYear()
) {
return true;
}
if (min) if (date < min) return false;
if (max) if (date > max) return false;
return true;
Expand Down

0 comments on commit 0f9cc52

Please sign in to comment.