mojombo / chronic

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

3rd Thursday of the month? #332

Open UnitedMarsupials-zz opened 8 years ago

UnitedMarsupials-zz commented 8 years ago

The title speaks for itself -- we need something done between 18:00 and 20:00 every third Thursday of the month. The only way to express the notion, that I was able to identify is by explicitly providing the month-name:

require 'chronic'

[
        '3rd Thursday',
        '3rd thursday',
        'third thursday',
        '3rd Thursday in this month',
        '3rd Thursday this month',
        '3rd Thursday in month',
        '3rd Thursday in June'
].each do |s|
        t = Chronic.parse(s)
        puts "#{s}: #{t}" unless t.nil?
end

We'd like to avoid that, obviously -- to keep the string unchanged from month to month.

davispuh commented 8 years ago

It works a bit better in my rewrite branch, for more info see #278 But that rewrite isn't really finished yet... and there it would be really easy to add support for all these cases.

alexagranov-theorchard commented 7 years ago

👍 Someone should really bump up this rewrite branch. You know what else this rewrite fixes:

Chronic.parse('5pm tomorrow')

I was just about to log an issue on the main repo that while 'tomorrow 5pm' works (and has tests) the converse '5pm tomorrow' fails...