ruby - Date returns non-existing day -
i'd iterate on days in month, so:
require 'time' time.now.month # => 5 time.now.day.next # => 32
what mean? 32nd of may?
also,
rota.rb:2:in `<main>': undefined method `days_in_month' time:class (nomethoderror)
what's wrong?
this should explain it:
time.now.day.class => fixnum
fixnum doesn't know dates, have method next
.
if want advance next day then:
(time.now + (60 * 60 * 24)).day => 1
or if have rails installed can do:
require 'active_support/time' (time.now + 1.day).day => 1
Comments
Post a Comment