Skip to content

Commit 72e6b02

Browse files
authored
Refactor leap year to use divisible_by? (#13982)
1 parent 9648f2b commit 72e6b02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/time.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ struct Time
10411041
raise ArgumentError.new "Invalid year"
10421042
end
10431043

1044-
year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
1044+
year.divisible_by?(4) && (!year.divisible_by?(100) || year.divisible_by?(400))
10451045
end
10461046

10471047
# Prints this `Time` to *io*.

0 commit comments

Comments
 (0)