[GH-ISSUE #406] [Bug]: Date filtering by month triggers crash #7091

Closed
opened 2026-04-10 16:45:35 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @biohzrddd on GitHub (Dec 21, 2022).
Original GitHub issue: https://github.com/actualbudget/actual/issues/406

Verified issue does not already exist?

I have searched and found no existing issue

What happened?

See below video. In accounts: Filter > Date > Change Date to Month > RangeError

Additionally, we should be consistent in the date format used for filtering Date, Month and Year and converting between them should pick a sane value based on the previous selection.
Currently
Date: yyyy/mm/dd
Month: mm/yyyy
Year:

Ideally
Date: yyyy/mm/dd
Month: yyyy/mm
Year: yyyy

https://user-images.githubusercontent.com/10577752/209000486-d58d8652-0b6b-43c9-a60a-7151f1957610.mp4

What error did you receive?

RangeError: Invalid time value
format
node_modules/date-fns/esm/format/index.js:363

360 | var originalDate = toDate(dirtyDate);
361 |
362 | if (!isValid(originalDate)) {

363 | throw new RangeError('Invalid time value');
| ^ 364 | } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
365 | // This ensures that when UTC functions will be implemented, locales will be compatible with them.
366 | // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376

Where are you hosting Actual?

Locally via Yarn

What browsers are you seeing the problem on?

Firefox

Operating System

Windows 10

Originally created by @biohzrddd on GitHub (Dec 21, 2022). Original GitHub issue: https://github.com/actualbudget/actual/issues/406 ### Verified issue does not already exist? I have searched and found no existing issue ### What happened? See below video. In accounts: Filter > Date > Change Date to Month > RangeError Additionally, we should be consistent in the date format used for filtering Date, Month and Year and converting between them should pick a sane value based on the previous selection. **Currently** Date: yyyy/mm/dd Month: mm/yyyy Year: **Ideally** Date: yyyy/mm/dd Month: yyyy/mm Year: yyyy https://user-images.githubusercontent.com/10577752/209000486-d58d8652-0b6b-43c9-a60a-7151f1957610.mp4 ### What error did you receive? RangeError: Invalid time value format node_modules/date-fns/esm/format/index.js:363 360 | var originalDate = toDate(dirtyDate); 361 | 362 | if (!isValid(originalDate)) { > 363 | throw new RangeError('Invalid time value'); | ^ 364 | } // Convert the date in system timezone to the same date in UTC+00:00 timezone. 365 | // This ensures that when UTC functions will be implemented, locales will be compatible with them. 366 | // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376 ### Where are you hosting Actual? Locally via Yarn ### What browsers are you seeing the problem on? Firefox ### Operating System Windows 10
GiteaMirror added the bug label 2026-04-10 16:45:35 -05:00
Author
Owner

@Kidglove57 commented on GitHub (Dec 21, 2022):

This is odd in that personally I cannot reproduce this crash. I have tried in both Firefox, Chrome and Safari.
Edit - I am in Mac not Windows

<!-- gh-comment-id:1362178655 --> @Kidglove57 commented on GitHub (Dec 21, 2022): This is odd in that personally I cannot reproduce this crash. I have tried in both Firefox, Chrome and Safari. Edit - I am in Mac not Windows
Author
Owner

@manuelcanepa commented on GitHub (Dec 23, 2022):

This can be fixed editing this file: https://github.com/actualbudget/actual/blob/master/packages/loot-design/src/components/DateSelect.js#L331

Adding an if:

              if (date instanceof Date && !isNaN(date)) {
                onSelect(d.format(date, 'yyyy-MM-dd'));
              }
<!-- gh-comment-id:1364356442 --> @manuelcanepa commented on GitHub (Dec 23, 2022): This can be fixed editing this file: https://github.com/actualbudget/actual/blob/master/packages/loot-design/src/components/DateSelect.js#L331 Adding an if: ``` if (date instanceof Date && !isNaN(date)) { onSelect(d.format(date, 'yyyy-MM-dd')); } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#7091