You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
732 B
JavaScript

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;