| 527 | } |
| 528 | |
| 529 | uint8_t getMonthTotalDay(uint16_t year, MonthId month) |
| 530 | { |
| 531 | static constexpr std::pair<MonthId, uint8_t> month_table[] = { |
| 532 | { MonthId::january, 31 }, |
| 533 | { MonthId::february, 28 }, |
| 534 | { MonthId::march, 31 }, |
| 535 | { MonthId::april, 30 }, |
| 536 | { MonthId::may, 31 }, |
| 537 | { MonthId::june, 30 }, |
| 538 | { MonthId::july, 31 }, |
| 539 | { MonthId::august, 31 }, |
| 540 | { MonthId::september, 30 }, |
| 541 | { MonthId::october, 31 }, |
| 542 | { MonthId::november, 30 }, |
| 543 | { MonthId::december, 31 }, |
| 544 | }; |
| 545 | bool extraDay = month == MonthId::february && isLeapYear(year); |
| 546 | return month_table[(uint8_t)month].second + extraDay; |
| 547 | } |
| 548 | } |
no test coverage detected