Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

janhassel
Copy link
Member

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

  • Use "months" preset if 364 days or less.
  • Updated test to catch this

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"

@janhassel janhassel requested a review from a team as a code owner January 10, 2025 09:56
@janhassel janhassel requested review from kennylam and guidari January 10, 2025 09:56
Copy link

netlify bot commented Jan 10, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 5e3c3fa
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/6780eec2c9900a0008a47bf9
😎 Deploy Preview https://deploy-preview-18322--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 10, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 5e3c3fa
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/6780eec2ad6946000836c4aa
😎 Deploy Preview https://deploy-preview-18322--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 10, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 5e3c3fa
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/6780eec25cf2fa0008877872
😎 Deploy Preview https://deploy-preview-18322--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.17%. Comparing base (9840477) to head (5e3c3fa).

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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants