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

Add support for formatting relative times #286

Merged
merged 3 commits into from
Dec 5, 2024
Merged

Conversation

connor-baer
Copy link
Member

@connor-baer connor-baer commented Dec 5, 2024

Purpose

The Intl.RelativeTimeFormat object enables language-sensitive relative time formatting, e.g. "1 day ago" or "in 5 months". It's widely supported in browsers, with only Safari lagging behind.

Approach and changes

  • Added formatRelativeTime, formatRelativeTimeToParts, resolveRelativeTimeFormat, and isRelativeTimeFormatSupported

Definition of done

  • Development completed
  • Reviewers assigned
  • Unit and integration tests
  • Meets minimum browser support
  • Meets accessibility requirements

Copy link

changeset-bot bot commented Dec 5, 2024

🦋 Changeset detected

Latest commit: c33384d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sumup-oss/intl Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 97.05882% with 3 lines in your changes missing coverage. Please review.

Project coverage is 94.00%. Comparing base (8c2eefd) to head (ee024f9).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/lib/relative-time-format/intl.ts 81.81% 2 Missing ⚠️
src/lib/relative-time-format/index.ts 98.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #286      +/-   ##
==========================================
+ Coverage   93.56%   94.00%   +0.43%     
==========================================
  Files          16       19       +3     
  Lines         715      817     +102     
  Branches       97      124      +27     
==========================================
+ Hits          669      768      +99     
- Misses         44       47       +3     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@connor-baer connor-baer marked this pull request as ready for review December 5, 2024 21:51
@connor-baer connor-baer merged commit 4e0b0bc into main Dec 5, 2024
4 checks passed
@connor-baer connor-baer deleted the feature/relative-time branch December 5, 2024 21:54
@connor-baer connor-baer mentioned this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant