-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Need support for DateTimeFormat/NumberFormat#formatToParts()
#1048
Comments
DateTimeFormat/NumberFormat#formatToParts()
DateTimeFormat/NumberFormat#formatToParts()
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
@zincli can you please re-open, pretty interested to see some support for this as well. |
This was a pretty compelling use case: #874 |
hmm I'm considering adding a new component like cc @redonkulus |
@longlho What would the API look like for this? |
<FormattedDateParts>
{(parts: Intl.DateTimeFormatPart[]) => (
<b>{parts[0]}</b>
{parts[1]}
<small>{parts[2]}</small>
)}
</FormattedDateParts> although I'd like to learn more about this use case, because ordering of the parts along w/ length of the |
I think correct usage would be something like this: <FormattedDateParts>
{parts => parts.map(part =>
<span className={`number-part-${part.type}`}>{part.value}<span>
)}
</FormattedDateParts> .number-part-integer {
font-size: 14px;
}
.number-part-fraction {
font-size: 10px;
} |
yeah I got that, but I feel like the styling would still be fairly inconsistent cross-locale Anw, this does fit w/ the intention of the original 3.2 is looking like this feature + /~https://github.com/formatjs/formatjs/tree/master/packages/intl-unified-numberformat would make it |
|
What about a |
Is there any plan to support
formatToParts()
? We need this to style the price and the currency symbol...Due to this issue#30 of ECMA402,
formatToParts()
already reached Stage 4. And the Intl Polyfill already have the implementations.Maybe we could do some work to make this available in react-intl as an optional function?
@ericf I saw you in #30 and other related issues in react-intl. What do you think about this now?
The text was updated successfully, but these errors were encountered: