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

Adds in default Intl.DateTimeFormat #127

Merged
merged 21 commits into from
Nov 29, 2022

Conversation

TatianaKapos
Copy link

@TatianaKapos TatianaKapos commented Aug 30, 2022

Description

Adds in a basic Intl.DateTimeFormat, see https://tc39.es/ecma402/#datetimeformat-objects. This DateTimeFormat has all the options but dayPeriod and more work is required to fully meet ECMA402 specification.

Takes a lot of code/functions/styling from apples current implementation (https://github.com/facebook/hermes/blob/main/lib/Platform/Intl/PlatformIntlApple.mm) and added them into a shared code file. You also won't get this change by default, you'll still need to set the HERMES_ENABLE_INTL flag to ON.

Reason for Change

See #87. TDLR: start of work to adding windows support for the Intl APIs. Android already supports the Intl APIs while Apple has starting filling out their own implementation (facebook@150bf0e and beyond). We should follow suit as Hermes becomes the default engine for RNW and has already been asks for it.

Further work need to match ECMA402 specifications

  • Implementation needed for DateTimeFormat.formatToParts
  • Add support for dayPeriod Option
  • Add testing and validation for incorrect input

Testing

Unit Tests included in PR and passing. Expected output matching when plugged into https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
image

Current Status of test262.js files, since we only have DateTimeFormat implemented, I would expect a lot of these tests to fail
image

Microsoft Reviewers: Open in CodeFlow

@TatianaKapos TatianaKapos marked this pull request as ready for review September 8, 2022 23:21
@TatianaKapos TatianaKapos requested a review from a team as a code owner September 8, 2022 23:21
@vmoroz
Copy link
Member

vmoroz commented Sep 9, 2022

@TatianaKapos, just FYI: I had fixed the CodeFlow link in the description.

@TatianaKapos TatianaKapos changed the title [WIP] Adds in default Intl.DateTimeFormat Adds in default Intl.DateTimeFormat Sep 9, 2022
Copy link

@mganandraj mganandraj left a comment

Choose a reason for hiding this comment

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

:shipit:

@TatianaKapos TatianaKapos merged commit f5d4942 into microsoft:main Nov 29, 2022
@TatianaKapos TatianaKapos deleted the tk-datetimeformat branch November 29, 2022 00:01
manuelpuyol added a commit to manuelpuyol/hermes that referenced this pull request Mar 22, 2024
See microsoft#127
This implements format, supportedLocalesOf and resolvedOptions
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.

3 participants