-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix year-over-year comparisons for leap years
When comparing dates year-over-year, the previous logic always shifted by 365 days, which caused issues with leap years. This means when comparing e.g. last 7 days vs a year ago in 2025, you would compare Jan 6th and Jan 7th. The new logic uses `Date.shift` while ensuring that the compared date range stays the same length as original date range. This can cause some oddities around Feb 29th where dates can get offset by 1 at the end of the range (see tests) Helpscout ref: https://secure.helpscout.net/conversation/2809180400/22224?viewId=6980900
- Loading branch information
Showing
3 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters