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 Temporal objects #250

Merged
merged 3 commits into from
Aug 14, 2024
Merged

Add support for Temporal objects #250

merged 3 commits into from
Aug 14, 2024

Conversation

connor-baer
Copy link
Member

@connor-baer connor-baer commented Aug 14, 2024

Purpose

SumUp has decided to adopt Temporal, the upcoming modern date/time API for the ECMAScript language, to handle dates and times in web applications. Replacing heavy date-time libraries currently in use will improve page load performance, while converging on a single standardized API will ensure interoperability and consistency between applications.

The proposal for Temporal has been making its way through the ECMAScript standardization process since 2017. It has reached stage 3 (recommended for implementation) but hasn't been implemented and unflagged in any browsers yet.

Until the Temporal API is widely supported, we will use the temporal-polyfill package, a well-tested, spec-compliant polyfill. We can guard against incompatibilities with future spec changes by importing the polyfill locally, not globally, effectively treating it as a regular dependency, which enables us to safely adjust our code (if necessary) when we upgrade to the latest/final polyfill/spec version.

Approach and changes

  • Add temporal-polyfill as a required peer dependency. I chose a strict dependency range (0.2.x) since there might be breaking changes between minor versions. We'll need to test new versions for compatibility and adjust the allowed version range accordingly.
  • Use the Intl.DateTimeFormat constructor from temporal-polyfill which has been patched with support for Temporal objects.

Definition of done

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

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.27%. Comparing base (6b8dc64) to head (d9b725e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #250      +/-   ##
==========================================
+ Coverage   93.26%   93.27%   +0.01%     
==========================================
  Files          15       15              
  Lines         668      669       +1     
  Branches       84       84              
==========================================
+ Hits          623      624       +1     
  Misses         43       43              
  Partials        2        2              

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

Copy link

changeset-bot bot commented Aug 14, 2024

🦋 Changeset detected

Latest commit: e3211c9

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

This PR includes changesets to release 1 package
Name Type
@sumup/intl Major

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

@connor-baer connor-baer merged commit bf12d97 into main Aug 14, 2024
2 checks passed
@connor-baer connor-baer deleted the feature/temporal branch August 14, 2024 14:48
@connor-baer connor-baer mentioned this pull request Aug 14, 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