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

Strict order of day, month and year on date formats #360

Open gfalasca opened 7 years ago

gfalasca commented 7 years ago

Hi, we need to specify a strict order of the date components, like day first, then month and after year, so that a date like "13/11/70" is recognised as 13th Nov 1970 while "11/13/70" should throw an error (nil). Is that possible?

davispuh commented 7 years ago

If you already now format, you could use just Date.strptime(str, "%d/%m/%y")

Currently for Chronic there isn't builtin option, but you can override Definitions see lib/chronic/definition.rb

Note that in my rewrite branch which will be next major release this format is changed lib/chronic/definition.rb