mojombo / chronic

Chronic is a pure Ruby natural language date parser.
http://injekt.github.com/chronic
MIT License
3.24k stars 461 forks source link

Can't parse `2nd sunday in march 2014` #283

Closed dankohn closed 10 years ago

dankohn commented 10 years ago
Loading development environment (Rails 4.1.7)
[1] pry(main)> Chronic.parse('2nd sunday in march')
2015-03-08 12:30:00 -0400
[2] pry(main)> Chronic.parse('2nd sunday in march 2014')
nil

It seems Chronic should be able to combine 2nd sunday with a specific month and year, but I couldn't figure out the syntax to have it do so.

Thanks.

davispuh commented 10 years ago

I don't think Chronic have ever supported this format (with year). But it will work when #278 will be done. With that PR

Chronic.parse('2nd sunday march 2014', :guess => false) # it doesn't work with "in", but that will be fixed
=> 2014-03-09 00:00:00 +0200...2014-03-10 00:00:00 +0200
dankohn commented 10 years ago

OK, thanks.