ISO8601d: Added ::daysInMonth and tests

This commit is contained in:
Paul Beckingham 2015-09-26 13:52:43 -04:00
parent 6f5d07dcd4
commit d8eb0ac0da
3 changed files with 18 additions and 1 deletions

View file

@ -806,6 +806,18 @@ bool ISO8601d::leapYear (int year)
! (year % 400);
}
////////////////////////////////////////////////////////////////////////////////
// Static
int ISO8601d::daysInMonth (int month, int year)
{
static int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (month == 2 && ISO8601d::leapYear (year))
return 29;
return days[month - 1];
}
////////////////////////////////////////////////////////////////////////////////
// Static
int ISO8601d::dayOfWeek (const std::string& input)