diff --git a/include/date/julian.h b/include/date/julian.h index 7869792..d909d69 100644 --- a/include/date/julian.h +++ b/include/date/julian.h @@ -1655,9 +1655,12 @@ inline bool month_day::ok() const NOEXCEPT { - CONSTDATA julian::day d[] = - {31_d, 29_d, 31_d, 30_d, 31_d, 30_d, 31_d, 31_d, 30_d, 31_d, 30_d, 31_d}; - return m_.ok() && 1_d <= d_ && d_ <= d[static_cast(m_)-1]; + CONSTDATA julian::day d[] = { + julian::day(31), julian::day(29), julian::day(31), julian::day(30), + julian::day(31), julian::day(30), julian::day(31), julian::day(31), + julian::day(30), julian::day(31), julian::day(30), julian::day(31) + }; + return m_.ok() && julian::day(1) <= d_ && d_ <= d[static_cast(m_)-1]; } CONSTCD11 @@ -1946,9 +1949,12 @@ inline day year_month_day_last::day() const NOEXCEPT { - CONSTDATA julian::day d[] = - {31_d, 28_d, 31_d, 30_d, 31_d, 30_d, 31_d, 31_d, 30_d, 31_d, 30_d, 31_d}; - return month() != feb || !y_.is_leap() ? d[static_cast(month())-1] : 29_d; + CONSTDATA julian::day d[] = { + julian::day(31), julian::day(28), julian::day(31), julian::day(30), + julian::day(31), julian::day(30), julian::day(31), julian::day(31), + julian::day(30), julian::day(31), julian::day(30), julian::day(31) + }; + return month() != feb || !y_.is_leap() ? d[static_cast(month())-1] : julian::day(29); } CONSTCD14 @@ -2190,7 +2196,7 @@ year_month_day::ok() const NOEXCEPT { if (!(y_.ok() && m_.ok())) return false; - return 1_d <= d_ && d_ <= (y_/m_/last).day(); + return julian::day(1) <= d_ && d_ <= (y_/m_/last).day(); } CONSTCD11 diff --git a/include/date/solar_hijri.h b/include/date/solar_hijri.h index bca4db1..6f6c331 100644 --- a/include/date/solar_hijri.h +++ b/include/date/solar_hijri.h @@ -1707,9 +1707,13 @@ inline bool month_day::ok() const NOEXCEPT { - CONSTDATA solar_hijri::day d[] = - {31_d, 31_d, 31_d, 31_d, 31_d, 31_d, 30_d, 30_d, 30_d, 30_d, 30_d, 30_d}; - return m_.ok() && 1_d <= d_ && d_ <= d[static_cast(m_)-1]; + CONSTDATA solar_hijri::day d[] = { + solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31), + solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31), + solar_hijri::day(30), solar_hijri::day(30), solar_hijri::day(30), + solar_hijri::day(30), solar_hijri::day(30), solar_hijri::day(30) + }; + return m_.ok() && solar_hijri::day(1) <= d_ && d_ <= d[static_cast(m_)-1]; } CONSTCD11 @@ -1998,10 +2002,14 @@ inline day year_month_day_last::day() const NOEXCEPT { - CONSTDATA solar_hijri::day d[] = - {31_d, 31_d, 31_d, 31_d, 31_d, 31_d, 30_d, 30_d, 30_d, 30_d, 30_d, 29_d}; + CONSTDATA solar_hijri::day d[] = { + solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31), + solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31), + solar_hijri::day(30), solar_hijri::day(30), solar_hijri::day(30), + solar_hijri::day(30), solar_hijri::day(30), solar_hijri::day(29) + }; return month() != esf || !y_.is_leap() ? - d[static_cast(month())-1] : 30_d; + d[static_cast(month()) - 1] : solar_hijri::day(30); } CONSTCD14 @@ -2260,7 +2268,7 @@ year_month_day::ok() const NOEXCEPT { if (!(y_.ok() && m_.ok())) return false; - return 1_d <= d_ && d_ <= (y_/m_/last).day(); + return solar_hijri::day(1) <= d_ && d_ <= (y_/m_/last).day(); } CONSTCD11