Skip to content

Instantly share code, notes, and snippets.

@chrisjpowers
Created November 2, 2010 20:47
Show Gist options
  • Save chrisjpowers/660275 to your computer and use it in GitHub Desktop.
Save chrisjpowers/660275 to your computer and use it in GitHub Desktop.
Strange Chronic date parsing, at least if today is 11/2/2010
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
@mcculloughsean
Copy link

Are you using ruby 1.9?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment