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

Un-parseable date #405

Open CromonMS opened 3 years ago

CromonMS commented 3 years ago

This Date String does not seem to parse, but the day after it does:

2.7.2 (main):0 > Chronic.parse('3/28/21 12:25am', endian_precedence: :little)&.end_of_month                   
=> nil
2.7.2 (main):0 > Chronic.parse('3/29/21 12:25am', endian_precedence: :little)&.end_of_month                   
=> 2021-03-31 23:59:59.999999999 +0100

Not sure why the first one isn't working, any ideas?

Thanks.

joevandyk commented 3 years ago

works for me? on OSX

irb(main):001:0> Chronic.parse('3/28/21 12:25am', endian_precedence: :little)&.end_of_month
=> Wed, 31 Mar 2021 23:59:59 PDT -07:00

irb(main):002:0> Chronic::VERSION
=> "0.10.2"
CromonMS commented 3 years ago

That's strange doesn't work on my VM (that's current version - but has never worked since the first post): Linux ubuntu 5.4.0-88-generic #99-Ubuntu SMP Thu Sep 23 17:29:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

but does work in production on: Linux ubuntu 5.4.0-81-generic #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

same version 0.10.2, what a strange quirk, must be a conflict with something on my VM..

viamin commented 1 year ago

I'm seeing something similar, and I'm guessing that it has something to do with time changes:

Chronic.parse("2023-03-12 12:15am")
=> nil
Chronic.parse("2023-03-12 1:15am")
=> 2023-03-12 00:15:00 -0800.  <= NOTE off by 1 hour
Time.parse("2023-03-12 1:15am")
=> 2023-03-12 01:15:00 -0800 <= Time.parse works fine
Chronic.parse("2023-03-12 3:15am")
=> 2023-03-12 03:15:00 -0700

Daylight savings time started on 2023-03-12 - Chronic seems to be treating the entire day as PDT, when PDT actually starts at 2:00am.