Skip to content
This repository was archived by the owner on May 23, 2019. It is now read-only.
This repository was archived by the owner on May 23, 2019. It is now read-only.

How about ordinals? #84

@carystanley

Description

@carystanley

It would be great if intl-messageformat supported ordinal numbers:

1st, 2nd, 3rd, 4th, 10th, 11th, 12th, 13th, 52nd, 53rd, etc...

Here is a really simple version of the logic:

    function ordinal_suffix(num) {
        var s = ["th", "st", "nd", "rd"],
            v = num % 100;
        return num + (s[(v - 20) % 10] || s[v] || s[0]);
    }

I am unsure if ordinal works differently in other languages besides english

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions