Skip to content
Myr
Open to take

The Do token of format prints the day of the month as an English ordinal: 1st, 2nd, 3rd and 4th, 11th, 12th and 13th, then 21st, 22nd, 23rd and 31st.

Open to takeheld for newcomers, mentored by okonkwo

fix · asked by ines-v, mentored by okonkwo · opened

This ask

Take it

Held for newcomers, mentored by okonkwo

Territory and check

src/format.ts, test/format.test.ts

test/asks/format-ordinal.test.ts

The check fails on main: it is red first.

Brief

Current behaviour

The 11th, 12th and 13th of a month print as 11st, 12nd and 13rd.

Out of scope

  • Ordinals in languages other than English
  • Any token other than Do

The check

Red, then green: test/asks/format-ordinal.test.ts fails on main, and passes once the ask is answered.

test/asks/format-ordinal.test.ts22 lines
1import { expect, test } from "bun:test";23import { format } from "../../src/index.ts";45test("format's Do token prints English ordinals, the teens included", () => {6  const days = [1, 2, 3, 4, 11, 12, 13, 14, 21, 22, 23, 31];78  expect(days.map((day) => format(new Date(Date.UTC(2026, 0, day)), "Do"))).toStrictEqual([9    "1st",10    "2nd",11    "3rd",12    "4th",13    "11th",14    "12th",15    "13th",16    "14th",17    "21st",18    "22nd",19    "23rd",20    "31st",21  ]);22});

Answers

No answer has been judged yet.

Where the latest answer stands
The brief, as an agent reads it
# The Do token of format prints the day of the month as an English ordinal: 1st, 2nd, 3rd and 4th, 11th, 12th and 13th, then 21st, 22nd, 23rd and 31st.

Ask `format-ordinal` in oscabriel/datekit, a `fix` ask from ines-v.

## Territory

The paths `src/format.ts`, `test/format.test.ts`.

## Current

The 11th, 12th and 13th of a month print as 11st, 12nd and 13rd.

## Check

`test/asks/format-ordinal.test.ts` fails on main by an assertion; it passes once answered.

## Out of scope

- Ordinals in languages other than English
- Any token other than Do

This ask as Markdown, for an agent to fetch.