|
@@ -1552,6 +1552,9 @@ createApp({
|
|
|
const pad = n => String(n).padStart(2, '0');
|
|
const pad = n => String(n).padStart(2, '0');
|
|
|
const MONTHS_LONG = ['January','February','March','April','May','June','July','August','September','October','November','December'];
|
|
const MONTHS_LONG = ['January','February','March','April','May','June','July','August','September','October','November','December'];
|
|
|
const MONTHS_SHORT = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
|
|
const MONTHS_SHORT = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
|
|
|
|
|
+ const DAYS_SHORT = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
|
|
|
|
|
+ const h24 = date.getHours();
|
|
|
|
|
+ const h12 = h24 % 12 || 12;
|
|
|
return fmt
|
|
return fmt
|
|
|
.replace(/%-d/g, String(date.getDate()))
|
|
.replace(/%-d/g, String(date.getDate()))
|
|
|
.replace(/%d/g, pad(date.getDate()))
|
|
.replace(/%d/g, pad(date.getDate()))
|
|
@@ -1559,8 +1562,12 @@ createApp({
|
|
|
.replace(/%m/g, pad(date.getMonth() + 1))
|
|
.replace(/%m/g, pad(date.getMonth() + 1))
|
|
|
.replace(/%B/g, MONTHS_LONG[date.getMonth()])
|
|
.replace(/%B/g, MONTHS_LONG[date.getMonth()])
|
|
|
.replace(/%b/g, MONTHS_SHORT[date.getMonth()])
|
|
.replace(/%b/g, MONTHS_SHORT[date.getMonth()])
|
|
|
|
|
+ .replace(/%a/g, DAYS_SHORT[date.getDay()])
|
|
|
.replace(/%Y/g, String(date.getFullYear()))
|
|
.replace(/%Y/g, String(date.getFullYear()))
|
|
|
- .replace(/%y/g, String(date.getFullYear()).slice(-2));
|
|
|
|
|
|
|
+ .replace(/%y/g, String(date.getFullYear()).slice(-2))
|
|
|
|
|
+ .replace(/%-I/g, String(h12))
|
|
|
|
|
+ .replace(/%I/g, pad(h12))
|
|
|
|
|
+ .replace(/%p/g, h24 < 12 ? 'AM' : 'PM');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function applyTemplate(name) {
|
|
function applyTemplate(name) {
|