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

Draft: Implement formatRange and formatRangeToParts on Apple and Android platforms #1219

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ewlsh
Copy link

@ewlsh ewlsh commented Dec 12, 2023

Summary

We want to support formatRange and formatRangeToParts for Intl.DateTimeFormat on Android and iOS. Our company uses the Android implementation internally and will use the iOS implementation once we move iOS to Hermes.

I've added a basic fallback for older Android versions, we don't use this internally but I'll test it.

For Apple this introduces support for formatToParts using the skeleton string to "build" each part - formatting the parts individually. This is expensive but can be avoided in the future if we move the implementation to Swift and utilize Swift's AttributedString. Apple has been working on Swift/C++ cmake interop.

For Android and Apple this introduces support for formatRange uses the respective interval formatters on both platforms.

Test Plan

Adding support for existing test262 tests and porting some tests to the internal testsuite where the data won't align to do limitations in the Apple implementation

Many tests which use "const" are not actually testing the behavior of
the "const" keyword, they are just using it as it is standard practice
in newer JavaScript versions.

This allows allowlisting individual tests or directories which use
"const".

This commit additionally updates the skiplist for ECMA-402 2024
Also update the Android test262 runner to print the individual
testcases for debugging and visibility.
In DateTimeFormat the switch statement for the fractionalSecondDigits
skeleton currently is missing "break" statements - leading to incorrect
skeleton strings (e.g. SSSSSSS)
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Dec 12, 2023
@ewlsh
Copy link
Author

ewlsh commented Dec 12, 2023

I'm working on breaking apart our internal work into distinct MRs, this is currently rebased on #1218 but I may drop those commits soon.

@ewlsh ewlsh force-pushed the evanmh-intl-datetimeformat-format-range branch 2 times, most recently from b2168d8 to a692325 Compare December 12, 2023 07:54
@ewlsh ewlsh force-pushed the evanmh-intl-datetimeformat-format-range branch from a692325 to 1ccd29a Compare December 12, 2023 08:02
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: drop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants