Use class method to check leap years
This commit is contained in:
parent
04370c1fed
commit
30d0224685
1 changed files with 1 additions and 1 deletions
|
@ -397,7 +397,7 @@ class Date
|
||||||
|
|
||||||
days = MONTH_LENGTHS[month-1]
|
days = MONTH_LENGTHS[month-1]
|
||||||
|
|
||||||
days = 29 if month == 2 and Date.civil(year,1,1).leap?
|
days = 29 if month == 2 and Date.leap?(year)
|
||||||
|
|
||||||
return days - ((Date.civil(year, month, days).wday - wday + 7) % 7)
|
return days - ((Date.civil(year, month, days).wday - wday + 7) % 7)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue