mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix #3460
This commit is contained in:
@@ -127,13 +127,13 @@ days_remaining :: proc "contextless" (date: Date) -> (days_remaining: i64, err:
|
|||||||
return delta.days, .None
|
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.
|
// Not using formula 2.27 from the book. This is far simpler and gives the same answer.
|
||||||
|
|
||||||
validate(Date{year, month, 1}) or_return
|
validate(Date{year, month, 1}) or_return
|
||||||
month_days := MONTH_DAYS
|
month_days := MONTH_DAYS
|
||||||
|
|
||||||
day = i64(month_days[month])
|
day = month_days[month]
|
||||||
if month == 2 && is_leap_year(year) {
|
if month == 2 && is_leap_year(year) {
|
||||||
day += 1
|
day += 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user