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

Closed
opened 2026-02-28 21:22:55 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/5622
Author: @itsbekas
Created: 8/24/2025
Status: Merged
Merged: 9/5/2025
Merged by: @youngcw

Base: masterHead: fix-5621


📝 Commits (3)

📊 Changes

2 files changed (+8 additions, -2 deletions)

View changed files

📝 packages/desktop-client/src/components/budget/MonthPicker.tsx (+2 -2)
upcoming-release-notes/5622.md (+6 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/5622 **Author:** [@itsbekas](https://github.com/itsbekas) **Created:** 8/24/2025 **Status:** ✅ Merged **Merged:** 9/5/2025 **Merged by:** [@youngcw](https://github.com/youngcw) **Base:** `master` ← **Head:** `fix-5621` --- ### 📝 Commits (3) - [`9398163`](https://github.com/actualbudget/actual/commit/9398163a3069cfc9ede24b29c0ad9df8bdbc2621) fix month range - [`05d649a`](https://github.com/actualbudget/actual/commit/05d649a32c4e57256652c1fafb0f8651f678fde3) release notes - [`3d166c5`](https://github.com/actualbudget/actual/commit/3d166c5bc7b50874644c9e1d3559392eb78e6f7b) use floor() to match e2e tests ### 📊 Changes **2 files changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/budget/MonthPicker.tsx` (+2 -2) ➕ `upcoming-release-notes/5622.md` (+6 -0) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 21:22:55 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6036