1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fix time_test.v

This commit is contained in:
Alexander Medvednikov 2019-07-14 17:08:14 +02:00
parent 6c2e313155
commit 7fa1f423e2

View File

@ -336,10 +336,7 @@ pub fn days_in_month(month, year int) ?int {
if month > 12 || month < 1 {
return error('Invalid month: $month')
}
if month == 2 {
return MonthDays[month-1] + if is_leap_year(year) {1} else {0}
} else {
return MonthDays[month-1]
}
extra := if month == 2 && is_leap_year(year) {1} else {0}
res := MonthDays[month-1] + extra
return res
}