datetimes
Version:
Extend class of Date
14 lines (12 loc) • 462 B
JavaScript
function DayPeriodExpression(dateRx, date, language) {
Expresion.call(this, dateRx, date, language);
this.oneDigit = null;
this.twoDigit = twoDigit;
this.threeDigit = null;
this.fourDigit = null;
this.otherDigit = null;
function twoDigit(input) {
var period = this.date.toLocaleString('en-US', { hour: 'numeric', hour12: true});
return input.replace(this.dateRx, period.replace(/[0-9\s]/g, ''));
}
}