This attribute lets you specify a month of a year in the following formats:
- YYYYMM
Use it as any other atk Attribute with
$this->add(new YearMonthAttribute('period', AF_OBLIGATORY));
Well, using YearMonth attribute will asure you that:
- No years below 1900 and above 2200 are entered.
- No month above 12 (i.e. 201714 will not be deemed valid).
The value will be stored in an int column in the form YYYYMM where:
- YYYY Is the year in 4 digits precision (i.e. 2017)
- MM is the month
Thus 201701 is lower than 201702 and higher than 201612.