Browse files

rails#759 -

There are two issues here:

#1) ActiveSupport::Date current method has a misleading conditional. is always returned because config.time_zone is set by default on a project.

#2) ActiveSupport::Date does not override the method. This means that the core ruby library's .today method is called which may be based off of a different time zone than what's set in config.time_zone.

Submitting a pull request.
  • Loading branch information...
1 parent ae65c0b commit 151723ed688eb161d9e6adc80a780912d9346940 @leepfrog leepfrog committed Jul 23, 2011
Showing with 7 additions and 2 deletions.
  1. +7 −2 activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -36,9 +36,14 @@ def tomorrow
- # Returns when <tt></tt> or <tt>config.time_zone</tt> are set, otherwise just returns
+ # Returns because <tt>config.time_zone</tt> is always set by default
def current
- ? :
+ end
+ # Overrides the core Ruby by returning back which allows yesterday, tomorrow, and today to all be based off of the same relative date
+ def today
+ ::Date.current

0 comments on commit 151723e

Please sign in to comment.