Closed chrisb34 closed 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.
Yeah, we'll definitely support this when Intl does. Closing for now though.
Any news on this issue ?
Unfortunately nothing in regards to browser/platform support has changed. The Intl API still does not support this, see the above linked issue.
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 ...