ISO8601d: Added ::daysInMonth and tests
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user