mojombo/chronic — Issue #85: New context: this_year
Author: gsinclair
Created: 2012-02-18 06:47:45+00:00
State: open

I like the contexts "past" and "future", but the application I'm working on generally requires dates to be in the current year. "Fri" should parse as the most recent Friday. "3 Jun" should parse as 3rd of June this year, whether that is in the past or the future.

Of course I could take the return value and create a new Date that has the current year, but what if I want to parse "5 Sep 2010"? That is pretty intentional and shouldn't be overridden.

So, just a thought: Chronic could provide a way for the date to be interpreted as _this year_ in the absence of conflicting information. I suppose the contexts "past" and "future" are still needed independently of this in order to interpret input like "Friday". This would be useful for me. Perhaps it is generally useful as well, perhaps not.