UNPKG

datetimes

Version:

Extend class of Date

25 lines (20 loc) 804 B
function MonthExpression(dateRx, date, language) { Expresion.call(this, dateRx, date, language); this.oneDigit = oneDigit; this.twoDigit = twoDigit; this.threeDigit = threeDigit; this.fourDigit = fourDigit; this.otherDigit = null; function oneDigit(input) { return input.replace(this.dateRx, (this.date.getMonth() + 1).toString()); } function twoDigit(input) { return input.replace(this.dateRx, (this.date.getMonth() + 1).toString().padStart(2, '0')); } function threeDigit(input) { return input.replace(this.dateRx, this.language.months[this.date.getMonth()].substr(0, 3)); } function fourDigit(input) { return input.replace(this.dateRx, this.language.months[this.date.getMonth()]); } }