Skip to content

Commit

Permalink
fix(parental-leave): Correct endDate for month slider (#16756)
Browse files Browse the repository at this point in the history
When the start day is 17 and end month has 31 days it was giving wrong endDate

Co-authored-by: hfhelgason <[email protected]>
Co-authored-by: Ylfa <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
4 people committed Nov 8, 2024
1 parent 7601fb6 commit 94aa36a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1449,8 +1449,9 @@ export const calculateEndDateForPeriodWithStartAndLength = (
endDate = addDays(endDate, -1)
}
} else {
// startDate is 16 and months with 31 days
if (start.getDate() === 16 && daysInMonth === 31) {
// startDate is 16 or 17 and months with 31 days
const startDay = start.getDate()
if ((startDay === 16 || startDay === 17) && daysInMonth === 31) {
endDate = addDays(endDate, 1)
}
}
Expand Down

0 comments on commit 94aa36a

Please sign in to comment.