You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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/2020now=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/21Chronic.parse("11/1",now: now)# => 2021-11-01 12:00:00 -0400# but it isn't with the month's nameChronic.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 futureChronic.parse("11/11",now: now)# => 2020-11-11 12:00:00 -0500Chronic.parse("Nov 11",now: now)# => 2020-11-11 12:00:00 -0500Chronic.parse("11/12",now: now)# => 2020-11-12 12:00:00 -0500Chronic.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?
The text was updated successfully, but these errors were encountered:
This seems to be a problem on the latest release of the gem v 0.10.2. This is not the case on Master as it appears this line fixed it.
agrberg
changed the title
Parser handles missing years differently with numbers vs month names
[Gem bug only] Parser handles missing years differently with numbers vs month names
Dec 31, 2019
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?The text was updated successfully, but these errors were encountered: