This commit is contained in:
Feoramund
2024-06-10 23:37:54 -04:00
parent f1779c85de
commit bd198aeada

View File

@@ -127,13 +127,13 @@ days_remaining :: proc "contextless" (date: Date) -> (days_remaining: i64, err:
return delta.days, .None
}
last_day_of_month :: proc "contextless" (#any_int year: i64, #any_int month: i8) -> (day: i64, err: Error) {
last_day_of_month :: proc "contextless" (#any_int year: i64, #any_int month: i8) -> (day: i8, err: Error) {
// Not using formula 2.27 from the book. This is far simpler and gives the same answer.
validate(Date{year, month, 1}) or_return
month_days := MONTH_DAYS
day = i64(month_days[month])
day = month_days[month]
if month == 2 && is_leap_year(year) {
day += 1
}