mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ISO8601d: Added ::daysInMonth and tests
This commit is contained in:
parent
6f5d07dcd4
commit
d8eb0ac0da
3 changed files with 18 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue