On Sun, Jan 1, 2012 at 10:49 AM, John Merlino <stoicism1@aol.com> wrote:
> It seems to parse the date wrong:
>
> Chronic.parse(eval("1/1/2011 - 1/1/2012"), :guess => false)
> => 2012-01-01 12:00:00 -0500..2012-01-01 12:00:01 -0500
>
> I specify two years, 2011 and 2012. And it returns a range of 2012.
Actually it returns a span of 1 second :-)
I was assuming your original example worked, but it doesn't. And I
haven't worked with Chronic much, so I'm not sure if that argument is
even something it's expected to handle. For example this works fine:
ruby-1.9.2-p290 :007 > result = Chronic.parse('last year', :guess => false)
=> 2011-01-01 00:00:00 -0800..2012-01-01 00:00:00 -0800
ruby-1.9.2-p290 :008 > result.class
=> Chronic::Span
ruby-1.9.2-p290 :009 > result.width
=> 31536000
while this obviously doesn't:
ruby-1.9.2-p290 :010 > result = Chronic.parse(1/1/2011 - 1/1/2012,
:guess => false)
=> 2012-01-01 12:00:00 -0800..2012-01-01 12:00:01 -0800
ruby-1.9.2-p290 :011 > result.class
=> Chronic::Span
ruby-1.9.2-p290 :012 > result.width
=> 1
ruby-1.9.2-p290 :013 >
Time to jump into the gem source, I think :-)
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment