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

Add support for day ordinals depending on Locale #1411

Closed
chrisb34 opened this issue Mar 31, 2023 · 4 comments
Closed

Add support for day ordinals depending on Locale #1411

chrisb34 opened this issue Mar 31, 2023 · 4 comments

Comments

@chrisb34
Copy link

I cannot see any way to get day ordinals with Luxon.

In moment, you can get these using: moment.localeData().ordinal(23) which will return '23rd'
or you can use the format string 'do' eg: 'do MMM YYYY'

It would be really good to see similar functions in Luxon ...

@diesieben07
Copy link
Collaborator

Luxon depends on the Intl API as its source of locale data. As far as I know there is currently no API to obtain the ordinal suffix for a number. You can get the type of suffix via Intl.PluralRules (it'll tell you one, two, few, etc. based on the number), but there is no API for the actual suffixes.
One would think Intl.NumberFormat would allow it, but it currently doesn't support formatting for ordinals, although there is an open issue: tc39/ecma402#494.

@icambron
Copy link
Member

icambron commented Apr 1, 2023

Yeah, we'll definitely support this when Intl does. Closing for now though.

@loatherer
Copy link

Any news on this issue ?

@diesieben07
Copy link
Collaborator

Unfortunately nothing in regards to browser/platform support has changed. The Intl API still does not support this, see the above linked issue.

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

No branches or pull requests

4 participants