Created
November 2, 2010 20:47
-
-
Save chrisjpowers/660275 to your computer and use it in GitHub Desktop.
Strange Chronic date parsing, at least if today is 11/2/2010
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'chronic' | |
# This has historically worked, but today, not so much | |
Chronic.parse "next Monday 4:00am" #=> nil | |
# Though it works fine in the afternoon | |
Chronic.parse "next Monday 4:00pm" #=> Mon Nov 08 16:00:00 -0600 2010 | |
# Doesn't work on Tuesday either | |
Chronic.parse "next Tuesday 4:00am" #=> nil | |
# ...but Sunday is golden | |
Chronic.parse "next Sunday 4:00am" #=> Sun Nov 07 04:00:00 -0600 2010 | |
# And here, it returns Tuesday when you ask for Monday | |
Chronic.parse "next Monday" #=> Tue Nov 09 11:00:00 -0600 2010 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are you using ruby 1.9?