-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(utilities/date-time-format): prevent "0 years" display #18322
base: main
Are you sure you want to change the base?
fix(utilities/date-time-format): prevent "0 years" display #18322
Conversation
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #18322 +/- ##
=======================================
Coverage 84.17% 84.17%
=======================================
Files 408 408
Lines 14435 14435
Branches 4640 4660 +20
=======================================
Hits 12150 12150
+ Misses 2121 2120 -1
- Partials 164 165 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM 💯
Since we define months as four-week periods instead of calendar months, the current implementation of relative date and time format can result in "0 years ago" displays. This code fixes it according to the guidelines.
Changelog
Changed
Testing / Reviewing
The updated automated test would fail with the previous implementation as it would result in "0 years ago" instead of "12 months ago"