Skip to content

Commit

Permalink
fix(ui/date): correctly adjust date when changing months #12270
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Jan 31, 2022
1 parent e0b6a3b commit 91bfef5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ui/src/utils/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,17 @@ function applyYearMonthDayChange (date, mod, sign) {
month += sign * mod.months
}

if (mod.days !== void 0) {
day += sign * mod.days
}

date.setDate(1)
date.setMonth(2)

date.setFullYear(year)
date.setMonth(month)

date.setDate(Math.min(day, daysInMonth(date)))

if (mod.days !== void 0) {
date.setDate(date.getDate() + sign * mod.days)
}

return date
}

Expand Down

0 comments on commit 91bfef5

Please sign in to comment.