UNPKG

datetimes

Version:

Extend class of Date

21 lines (17 loc) 646 B
function YearExpression(dateRx, date, language) { Expresion.call(this, dateRx, date, language); this.oneDigit = null; this.twoDigit = twoDigit; this.threeDigit = threeDigit; this.fourDigit = fourDigit; this.otherDigit = null; function twoDigit(input) { return input.replace(this.dateRx, this.date.getFullYear().toString().substr(2)); } function threeDigit(input) { return input.replace(this.dateRx, this.date.getFullYear().toString().substr(3)); } function fourDigit(input) { return input.replace(this.dateRx, this.date.getFullYear().toString()); } }