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.
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
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.Intl.DateTimeFormat
constructor fromtemporal-polyfill
which has been patched with support forTemporal
objects.Definition of done