moment / luxon

⏱ A library for working with dates and times in JS
https://moment.github.io/luxon
MIT License
15.26k stars 731 forks source link

Add support for day ordinals depending on Locale #1411

Closed chrisb34 closed 1 year ago

chrisb34 commented 1 year ago

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 commented 1 year ago

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: https://github.com/tc39/ecma402/issues/494.

icambron commented 1 year ago

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

loatherer commented 6 months ago

Any news on this issue ?

diesieben07 commented 6 months ago

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