You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which sets the start date to 1 Jan 2023. What the code should do here is subtract 12 months from the current date, then use that as the start date (or the first day of the next month after that date.) Alternatively, you could advance the date to the first day of the next month from the current date, then set the year number back by one. That would correct for the change in year from December to January.
# current date
2024-12-25
# advance to first of next month
2025-01-01
# back one year
2024-01-01
The text was updated successfully, but these errors were encountered:
eatyourgreens
changed the title
Stats: Last 12 Months showed two years on New Years Eve
Stats: Last 12 Months showed two years during December
Jan 4, 2025
Package
Describe the bug
Yesterday, 31st December 2024, the Last 12 Months option was consistently showing 24 months, starting Jan 2023.
To Reproduce
I think you have to select Last 12 Months during December to reproduce this. Maybe set up a test case with a mock clock?
Expected behavior
Last 12 Months should only show 12 months.
Additional context
https://www.zooniverse.org/talk/17/3531984?comment=5824612
The bug is in
value
here, which subtracts 24 months from the current date when the month is December.front-end-monorepo/packages/lib-user/src/components/shared/MainContent/helpers/getDateRangeSelectOptions.js
Lines 34 to 37 in 51f064e
In December 2024, that line evaluates to:
which sets the start date to 1 Jan 2023. What the code should do here is subtract 12 months from the current date, then use that as the start date (or the first day of the next month after that date.) Alternatively, you could advance the date to the first day of the next month from the current date, then set the year number back by one. That would correct for the change in year from December to January.
The text was updated successfully, but these errors were encountered: