This project is archived and is in readonly mode.
ActiveSupport Date class methods seem to be buggy
-
Utkarsh Kukreti
I'm getting
> Date.today == Date.tomorrow => true > Time.now => 2010-11-23 00:19:52 +0530 > Time.now.utc => 2010-11-22 18:49:54 UTCDate.tomorrow and Date.yesterday are not taking the local timezone into consideration, and are using the UTC offsets.
-
agmcleod
I'm having issues where Date.today isn't even resolving...
aaronmcleod@MacBook-Pro $ irb ruby-1.9.2-p0 > require 'active_support' => true ruby-1.9.2-p0 > Date.today NoMethodError: undefined method `today' for Date:Class from (irb):2 from /Users/aaronmcleod/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>' ruby-1.9.2-p0 > exit aaronmcleod@MacBook-Pro $ ruby -v ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] aaronmcleod@MacBook-Pro $ rails -v Rails 3.0.3 -
Xac
ActiveSupport is broken down into pieces that need to be individually required now.
Try "require 'active_support/core_ext/date'" for date helpers, or "require 'activesupport/all'" for the old functionality.
-
agmcleod
Ah alright, I have it working now. I seem to be getting the correct date & times. Note that I am in eastern standard time.
-
Rohit Arondekar
- Importance changed from to Low
Xac, Utkarsh: is this an issue of bad documentation of Date.yesterday and Date.tomorrow or bugs in the methods themselves?