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

Supported formatting APIs from Intl #774

Open
5 of 12 tasks
amannn opened this issue Jan 11, 2024 · 0 comments
Open
5 of 12 tasks

Supported formatting APIs from Intl #774

amannn opened this issue Jan 11, 2024 · 0 comments
Labels
area: standards enhancement New feature or request

Comments

@amannn
Copy link
Owner

amannn commented Jan 11, 2024

Is your feature request related to a problem? Please describe.

We currently support a subset of formatting APIs from Intl:

Intl.DateTimeFormat

Intl.NumberFormat

Intl.ListFormat

Intl.RelativeTimeFormat

Describe the solution you'd like

There are valid use cases for every API, potentially we could support all.

For now, we'll add APIs as necessary and reported by users.

This will increase bundle size though, we should evaluate how much. Potentially we could also split useFormatter into separate hooks like const dateTimeFormat = useDateTimeFormatter(), const relativeTimeFormat = useRelativeTimeFormat(), const numberFormat = useNumberFormatter() (could be introduced alongside useFormatter for a longer transition period).

Also note that only a subset of these formatting APIs is supported by ICU.

Describe alternatives you've considered

Supporting only a subset, e.g. none of the ToParts variants and asking users to implement this in userland.

There are even more APIs from Intl (not necessarily related to formatting), so we'll likely not wrap every single API.

@amannn amannn added enhancement New feature or request unconfirmed Needs triage. labels Jan 11, 2024
@amannn amannn changed the title Support all formatting APIs of the Intl namespace Supported formatting APIs from the Intl Jan 11, 2024
@amannn amannn changed the title Supported formatting APIs from the Intl Supported formatting APIs from Intl Jan 11, 2024
@amannn amannn removed the unconfirmed Needs triage. label Feb 6, 2024
amannn added a commit that referenced this issue Feb 19, 2024
Contributes to #774

Add support for
[Intl.DateTimeFormat.prototype.formatRange()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatRange)

---------

Co-authored-by: Jan Amann <jan@amann.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: standards enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant