You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tweaked the iso_week.h calendar to expose year::is_leap() directly, and then reuse it when determining year_lastweek::weeknum(). Would you be interested in having this upstream? It looks like the other calendars (like julian.h) have this function.
I used it here r-lib/clock#333, where I have calendar_leap_year() which takes an arbitrary calendar and reports on whether or not the year is a leap year, if the calendar supports such a thing. Having is_leap() made it slightly more straightforward to implement.
The text was updated successfully, but these errors were encountered:
For historical purposes, I also found this old commit that removed an iso_week::year::is_leap() method, but that one looks to have been treating the iso year in the same way as a Gregorian year, so that wasn't right. Likely a copy paste error when making the iso calendar? Anyways, just recording the finding for future readers: 323e2fa
I tweaked the
iso_week.h
calendar to exposeyear::is_leap()
directly, and then reuse it when determiningyear_lastweek::weeknum()
. Would you be interested in having this upstream? It looks like the other calendars (likejulian.h
) have this function.Implemented here:
r-lib/tzdb#27
I used it here r-lib/clock#333, where I have
calendar_leap_year()
which takes an arbitrary calendar and reports on whether or not the year is a leap year, if the calendar supports such a thing. Havingis_leap()
made it slightly more straightforward to implement.The text was updated successfully, but these errors were encountered: