mojombo / chronic

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

Incorrect `last monday` #383

Closed FX-HAO closed 6 years ago

FX-HAO commented 6 years ago
irb(main):006:0> Time.now
=> "2018-10-08T14:20:45.486+08:00"
irb(main):007:0> monday = Chronic.parse("last monday 0am")
=> "2018-10-01T00:00:00.000+08:00"
irb(main):008:0> monday = Chronic.parse("monday 0am")
=> "2018-10-15T00:00:00.000+08:00"

last monday 0am should return 2018-10-08T00:00:00.000+08:00

FX-HAO commented 6 years ago

I reconsider this issue, it's probably not a bug. It makes sense that last monday does not include today. What I really want is Chronic.parse("last monday 0am", now: Time.now + 1.days)