Timert raises an error for the last day of the year
Closed this issue · 0 comments
mkwiatkowski commented
The error was ArgumentError: argument out of range
in last_second_of_day
method when time is initialized with Time.new(2013, 12, 32, 0)
.
Quick fix I did, but maybe there is a better way:
def last_second_of_day(timestamp)
time = Time.at(timestamp)
if time.month == 12 and time.day == 31
Time.new(time.year + 1, 1, 1, 0)
else
Time.new(time.year, time.month, time.day + 1, 0)
end
end