class SmartDateMonthPart extends AbstractSmartDateNumericPart { constructor() { super(SmartDateFormat.MONTH_PLACEHOLDER, 2); } /** * @param {Date} date * @returns {String} */ formatDate(date) { return this.formatValue(date.getMonth() + 1); } /** * @param {SmartDateCheckState} state */ parse(state) { this._parsedValue = this.scanStringNumber(state); this._numericValue = this.calculateNumericValue(this._parsedValue, SmartDateMonthPart.MAXIMAL_VALUE); this._defineParsingState(SmartDateMonthPart.MAXIMAL_VALUE, state.isOver()); this._defineCleanValue(); } } SmartDateMonthPart.MAXIMAL_VALUE = 12;