mirror of
https://github.com/samsonjs/strftime.git
synced 2026-04-27 14:57:37 +00:00
allow localizing ordinals
This commit is contained in:
parent
f6c88d0629
commit
a54410d663
1 changed files with 5 additions and 1 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
||||||
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
||||||
shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||||
|
ordinalSuffixes: ['st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st'],
|
||||||
AM: 'AM',
|
AM: 'AM',
|
||||||
PM: 'PM',
|
PM: 'PM',
|
||||||
am: 'am',
|
am: 'am',
|
||||||
|
|
@ -431,7 +432,10 @@
|
||||||
// '1st'
|
// '1st'
|
||||||
// case 'o':
|
// case 'o':
|
||||||
case 111:
|
case 111:
|
||||||
resultString += String(date.getDate()) + ordinal(date.getDate());
|
// Try to use an ordinal suffix from the locale, but fall back to using the old
|
||||||
|
// function for compatibility with old locales that lack them.
|
||||||
|
var day = date.getDate();
|
||||||
|
resultString += String(day) + (locale.ordinalSuffixes[day - 1] || ordinal(day));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// 'AM'
|
// 'AM'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue