aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date/calculations.rb
diff options
context:
space:
mode:
authorGeoff Buesing <gbuesing@gmail.com>2010-06-08 21:35:39 -0500
committerXavier Noria <fxn@hashref.com>2010-06-12 00:19:12 +0200
commit4146a443b6ffc3d250a280a3b5218c0e5d1a54dd (patch)
treeb7375f69cf6806b5eb92374380840102a57ff867 /activesupport/lib/active_support/core_ext/date/calculations.rb
parent1a5654851e23b081c331bb3a7e0d0ffc2c2d6e51 (diff)
downloadrails-4146a443b6ffc3d250a280a3b5218c0e5d1a54dd.tar.gz
rails-4146a443b6ffc3d250a280a3b5218c0e5d1a54dd.tar.bz2
rails-4146a443b6ffc3d250a280a3b5218c0e5d1a54dd.zip
Date#since, #ago, #beginning_of_day, #end_of_day, #xmlschema return TimeWithZone when Time.zone_default is set
Signed-off-by: Xavier Noria <fxn@hashref.com>
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date/calculations.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index 579079d4f1..28fec5394f 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -57,19 +57,19 @@ class Date
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
# and then subtracts the specified number of seconds
def ago(seconds)
- to_time.since(-seconds)
+ to_time_in_current_zone.since(-seconds)
end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
# and then adds the specified number of seconds
def since(seconds)
- to_time.since(seconds)
+ to_time_in_current_zone.since(seconds)
end
alias :in :since
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
def beginning_of_day
- to_time
+ to_time_in_current_zone
end
alias :midnight :beginning_of_day
alias :at_midnight :beginning_of_day
@@ -77,7 +77,7 @@ class Date
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59)
def end_of_day
- to_time.end_of_day
+ to_time_in_current_zone.end_of_day
end
def plus_with_duration(other) #:nodoc: