fix: match day counting behavior with Day.js in English locale #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into an issue when counting days where the behavior seemed a little odd to me. I noticed that Day.js was cited for reference and confirmed that the behavior in Day.js is different. Essentially if I compare Monday 8:00AM to Wednesday 8:01AM it will return
3 days ago
instead of2 days ago
and it makes day counts feel 12 hours too early.Day.js has regular 24-hour intervals after the first long day, but timediff has a shorter 13-hour second day due to not offsetting for the long first day.
This change makes all the intervals a regular 24 hours after the first and updates the tests to reflect the changeover time. Hope that all makes sense. I could also try to adjust the other locales if that's helpful. Cheers!