1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

AK+LibC+LibCore: Have fewer implementations of days_in_month

This commit is contained in:
Nico Weber 2020-08-25 20:11:12 -04:00 committed by Andreas Kling
parent dcb81fc199
commit a7a18b478e
4 changed files with 20 additions and 16 deletions

View file

@ -71,12 +71,7 @@ unsigned DateTime::weekday() const
unsigned DateTime::days_in_month() const
{
bool is_long_month = (m_month == 1 || m_month == 3 || m_month == 5 || m_month == 7 || m_month == 8 || m_month == 10 || m_month == 12);
if (m_month == 2)
return is_leap_year() ? 29 : 28;
return is_long_month ? 31 : 30;
return ::days_in_month(m_year, m_month);
}
unsigned DateTime::day_of_year() const