[PR #5622] Fix range calculator on the MonthPicker component #13091

Closed
opened 2026-04-10 21:46:59 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/5622

State: closed
Merged: Yes


Fixes #5621

There's a weird behavior I can't seem to pinpoint with monthUtils.subMonth and float values, where sometimes the subtraction matches the result's ceiling, and other times it matches its floor, which I suspect is related to date-fns/date-fns#4061. In the meantime, I've simply made the operation always return the result's floor, in order to make the behavior predictable.

Example:
monthUtils.subMonths('2023-01', 4) = 2022-09
monthUtils.subMonths('2023-01', 4.5) = 2022-09

monthUtils.subMonths('2024-11', 4) = 2024-07
monthUtils.subMonths('2024-11', 4.5) = 2024-06

**Original Pull Request:** https://github.com/actualbudget/actual/pull/5622 **State:** closed **Merged:** Yes --- Fixes #5621 There's a weird behavior I can't seem to pinpoint with `monthUtils.subMonth` and float values, where sometimes the subtraction matches the result's ceiling, and other times it matches its floor, which I suspect is related to date-fns/date-fns#4061. In the meantime, I've simply made the operation always return the result's floor, in order to make the behavior predictable. Example: `monthUtils.subMonths('2023-01', 4)` = 2022-09 `monthUtils.subMonths('2023-01', 4.5)` = 2022-09 `monthUtils.subMonths('2024-11', 4)` = 2024-07 `monthUtils.subMonths('2024-11', 4.5)` = 2024-06
GiteaMirror added the pull-request label 2026-04-10 21:46:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#13091