Skip to content

Commit 3893d07

Browse files
author
Nathan Reyes
committed
Add missing format token 'Do' (Closes #127).
1 parent c09ac2f commit 3893d07

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/utils/locales.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ const getDayNames = (locale, length) => {
9494
return getWeekdayDates({ utc: true }).map(d => dtf.format(d));
9595
};
9696

97+
/* eslint-disable no-bitwise */
98+
const DoFn = d =>
99+
`${d}${[null, 'st', 'nd', 'rd'][((d % 100) >> 3) ^ 1 && d % 10] || 'th'}`;
100+
97101
export default locale => {
98102
const detectedLocale = new Intl.DateTimeFormat().resolvedOptions().locale;
99103
const searchLocales = [
@@ -124,5 +128,6 @@ export default locale => {
124128
dayNamesNarrow,
125129
monthNames,
126130
monthNamesShort,
131+
DoFn,
127132
};
128133
};

0 commit comments

Comments
 (0)