Chronic will advance the year properly for a date that is past for the current year if given in mm/dd format but it will not for month_name dd.
# Let's make it 11/11/2020
now = Chronic.construct(2020, 11, 11) # => 2020-11-11 00:00:00 -0500
# The first of November is in the past for 2020 so both "Nov 1" and "11/1" should be 11/1/21
Chronic.parse("11/1", now: now) # => 2021-11-01 12:00:00 -0400
# but it isn't with the month's name
Chronic.parse("Nov 1", now: now) # => 2020-11-01 11:00:00 -0500
# It uses the current year as expected for the current date or a date in the future
Chronic.parse("11/11", now: now) # => 2020-11-11 12:00:00 -0500
Chronic.parse("Nov 11", now: now) # => 2020-11-11 12:00:00 -0500
Chronic.parse("11/12", now: now) # => 2020-11-12 12:00:00 -0500
Chronic.parse("Nov 12", now: now) # => 2020-11-12 12:00:00 -0500
A little bit of digging suggests the reason is that the day is not taken into account in RepeaterMonthName#next. Is this the correct behavior or am I'm missing something?
Chronic will advance the year properly for a date that is past for the current year if given in
mm/dd
format but it will not formonth_name dd
.A little bit of digging suggests the reason is that the day is not taken into account in
RepeaterMonthName#next
. Is this the correct behavior or am I'm missing something?