Numeral-js icon indicating copy to clipboard operation
Numeral-js copied to clipboard

Allow to output ordinal suffixes without actual number.

Open undsoft opened this issue 11 years ago • 2 comments

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.

undsoft avatar Aug 21 '14 13:08 undsoft

Has there been any movement on this? I need this too.

bytenik avatar Aug 29 '16 14:08 bytenik

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);

Synvox avatar Oct 14 '22 16:10 Synvox