mirror of
https://github.com/samsonjs/strftime.git
synced 2026-03-25 09:05:48 +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'],
|
||||
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'],
|
||||
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',
|
||||
PM: 'PM',
|
||||
am: 'am',
|
||||
|
|
@ -431,7 +432,10 @@
|
|||
// '1st'
|
||||
// case 'o':
|
||||
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;
|
||||
|
||||
// 'AM'
|
||||
|
|
|
|||
Loading…
Reference in a new issue