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

Future time of day does not work #320

Open andrewhavens opened 8 years ago

andrewhavens commented 8 years ago

I expect the returned date to be tomorrow, not today.

> Time.now
=> 2016-01-08 12:35:06 -0800
> Chronic.parse "8am", context: :future
=> 2016-01-08 08:00:00 -0800

I could use "next"...

> Time.now
=> 2016-01-08 12:35:06 -0800
> Chronic.parse "Next 8am", context: :future
=> 2016-01-09 08:00:00 -0800

However, that does not work when you expect to return the current day:

> Time.now
=> 2016-01-08 12:35:06 -0800
> Chronic.parse "Next 2pm", context: :future
=> 2016-01-09 14:00:00 -0800
nikkypx commented 8 years ago

Does "today at 8:00" or "tomorrow at 8:00" solve your problem?

andrewhavens commented 8 years ago

@nikkypx No, the problem is that I'm asking Chronic to determine this by using the context: :future option. Chronic does not seem to be respecting this option. I just tried this again today using Chronic 0.10.2.