-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chronic.parse("today 11:00am") returns nil on 2011-11-06 #74
Comments
I was having a similar problem in 0.6.4 and updated to 0.6.6 which fixed the issue. Your problem seems to also be fixed in 0.6.6.
|
I still had similar problem in 0.6.6 too. It could be an issue from daylight saving time transition: Time.zone Chronic.parse('sunday next week', {:now=>Time.zone.parse('11/01/2011')}) Chronic.parse('sunday next week', {:now=>Time.zone.parse('10/24/2011')}) Chronic.parse('sunday next week') (I specified the :now option to make reproducing easier.) |
Presumably the same issue, today we have similar behavior: >> Chronic.debug = true
=> true
>> Chronic.parse "yesterday at 11:59", :now => Time.zone.parse('3/13/2012') # tomorrow we'll be ok
+---------------------------------------------------
| last(grabber-last) day(repeater-day) at(separator-at) 11:59(repeater-time-43140?)
+---------------------------------------------------
-anchor
--(Mon Mar 12 00:00:00 -0400 2012..Tue Mar 13 00:00:00 -0400 2012)
--(Mon Mar 12 00:00:00 -0400 2012..Tue Mar 13 00:00:00 -0400 2012)
--(Mon Mar 12 06:00:00 -0400 2012..Mon Mar 12 18:00:00 -0400 2012)
--(Mon Mar 12 11:59:00 -0400 2012..Mon Mar 12 11:59:01 -0400 2012)
=> Mon Mar 12 11:59:00 -0400 2012
>> Chronic.parse "yesterday at 11:59", :now => Time.zone.parse('3/12/2012') # today we get nil
+---------------------------------------------------
| last(grabber-last) day(repeater-day) at(separator-at) 11:59(repeater-time-43140?)
+---------------------------------------------------
-anchor
--(Sat Mar 10 23:00:00 -0500 2012..Mon Mar 12 00:00:00 -0400 2012)
--(Sat Mar 10 23:00:00 -0500 2012..Mon Mar 12 00:00:00 -0400 2012)
=> nil |
What I think this comes down to is that |
This might be related... I saw an error on Sunday, where Chronic was interpreting 12:30 PM as 12:30 AM on Sunday: ree-1.8.7-2010.02 :011 > Chronic.parse("12:30 PM", :now => Time.local(2012, 3, 11, 17, 0, 0, 0))
=> Mon Mar 12 00:30:00 -0400 2012
ree-1.8.7-2010.02 :012 > |
Similar problem, slightly different can be found here: |
This appears to be fixed in the latest revision of Chronic. Please re-open if you can reproduce these errors. |
The original issue may be resolved, but the other relate examples are unfortunately still not resolved.
Oops, this shouldn't return nil.
Should return:
I think @duelinmarkers is correct, the underlying issue is adding 86,400 seconds to advance to the next day, which just doesn't work on the days that have 23 or 25 hours. |
I can confirm that this issue still exists. |
+1 |
I have been having issues around daylight savings time changes with Chronic calls. Last sunday I was having issues with Chronic returning nil, but I didn't capture any way to reproduce the error. I had problems with Chronic again today, here is what I was noticing in my Rails 3.0.10 app (MRI ruby 1.9.2 and 1.9.3)
I was trying to reproduce Chronic returning me nil on 10-30 using Timecop, but was unable to reproduce the errors, so I don't know if you will be able to use something like Timecop to validate this issue after today.
I also did this little test in irb (ruby 1.9.3)
My servers (ruby 1.9.2) are running with the timezone set to GMT at the OS level, the development machines (1.9.2 and 1.9.3) are set to Central Time at the OS level.
The text was updated successfully, but these errors were encountered: