Numeral-js
Numeral-js copied to clipboard
Allow to output ordinal suffixes without actual number.
Hi,
I'm trying to output:
1<span class="suffix">st</span>
However, no matter what I try:
numeral(1).format('0o')
numeral(1).format('o')
numeral(1).format('0o0o0o0o')
The result is always the same: 1st.
What I expect is that when I use
numeral(1).format('o')
is that I should get "st" without a number.
Thanks.
Has there been any movement on this? I need this too.
I need this too. For the time being this is seems to be a viable workaround:
const lang = 'en'; // get your locale
const locale = numeral.locales[lang];
if (!locale) return "";
return locale.ordinal(value);