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
Labels
Comments
This was referenced Jan 11, 2024
amannn
changed the title
Support all formatting APIs of the
Supported formatting APIs from the Jan 11, 2024
Intl
namespaceIntl
amannn
changed the title
Supported formatting APIs from the
Supported formatting APIs from Jan 11, 2024
Intl
Intl
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 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
We currently support a subset of formatting APIs from
Intl
:Intl.DateTimeFormat
format
formatRange
(feat: Addformat.dateTimeRange
#769)formatToParts
formatRangeToParts
Intl.NumberFormat
format
formatRange
(see previous discussion in Add support for number range formatting #540)formatToParts
formatRangeToParts
Intl.ListFormat
format
formatToParts
Intl.RelativeTimeFormat
format
formatToParts
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 likeconst dateTimeFormat = useDateTimeFormatter()
,const relativeTimeFormat = useRelativeTimeFormat()
,const numberFormat = useNumberFormatter()
(could be introduced alongsideuseFormatter
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.The text was updated successfully, but these errors were encountered: