It seems like the Time.parse function behaves differently on my local
machine versus on Heroku.
When given the date of 2/14/2012, my local machine assumes month/day/
year and parses it just fine. However, Heroku assumes day/month/year.
So, when it is give to parse 2/14/2012 it gives me out of range error.
The outputs are below. Any idea why it does this? It is disrupting my
time values...
Heroku Console Output:
>> Time.zone
=> (GMT+00:00) UTC
>> Time.zone.parse("02/14/2012 03:00 am")
ArgumentError: invalid date
/usr/ruby1.9.2/lib/ruby/1.9.1/date.rb:1688:in `new_by_frags'
/usr/ruby1.9.2/lib/ruby/1.9.1/date.rb:1733:in `parse'
/app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/
active_support/values/time_zone.rb:271:in `rescue in parse'
/app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/
active_support/values/time_zone.rb:271:in `parse'
>> Time.zone.parse("02/12/2012 03:00 am")
=> Sun, 02 Dec 2012 03:00:00 UTC +00:00
My Workstation Output:
irb(main):008:0> Time.zone
=> #<ActiveSupport::TimeZone:0xb6bfdc5c
@tzinfo=#<TZInfo::TimezoneProxy: Etc/UTC>, @utc_offset=nil,
@current_period=nil, @name="UTC">
irb(main):009:0> Time.zone.parse("02/14/2012 03:00 am")
=> Tue, 14 Feb 2012 03:00:00 UTC +00:00
irb(main):010:0> Time.zone.parse("02/12/2012 03:00 am")
=> Sun, 12 Feb 2012 03:00:00 UTC +00:00
--
You received this message because you are subscribed to the Google Groups
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en.