aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorgbuesing <gbuesing@gmail.com>2008-04-12 17:37:50 -0500
committergbuesing <gbuesing@gmail.com>2008-04-12 17:37:50 -0500
commitf285b6119b9ca7f598e31c0c8518dce3e1b13386 (patch)
treece9638a8ac751a18b8255b495707694f22f6d7c1 /activesupport
parent0289b0e7dff1c114a090f905406cc212d9e3570e (diff)
downloadrails-f285b6119b9ca7f598e31c0c8518dce3e1b13386.tar.gz
rails-f285b6119b9ca7f598e31c0c8518dce3e1b13386.tar.bz2
rails-f285b6119b9ca7f598e31c0c8518dce3e1b13386.zip
Add #getutc alias for DateTime#utc
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/calculations.rb1
-rw-r--r--activesupport/test/core_ext/date_time_ext_test.rb1
3 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index c28d630f5d..2c5042c9ef 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Add #getutc alias for DateTime#utc [Geoff Buesing]
+
* Refactor TimeWithZone: don't send #since, #ago, #+, #-, #advance through method_missing [Geoff Buesing]
* TimeWithZone respects config.active_support.use_standard_json_time_format [Geoff Buesing]
diff --git a/activesupport/lib/active_support/core_ext/date_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
index 5c351c21c6..fa444f71b1 100644
--- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
@@ -86,6 +86,7 @@ module ActiveSupport #:nodoc:
def utc
new_offset(0)
end
+ alias_method :getutc, :utc
# Returns true if offset == 0
def utc?
diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb
index 25a8e878f9..ed45daf403 100644
--- a/activesupport/test/core_ext/date_time_ext_test.rb
+++ b/activesupport/test/core_ext/date_time_ext_test.rb
@@ -240,6 +240,7 @@ class DateTimeExtCalculationsTest < Test::Unit::TestCase
assert_equal DateTime.civil(2005, 2, 21, 15, 11, 12, 0), DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-5, 24)).utc
assert_equal DateTime.civil(2005, 2, 21, 10, 11, 12, 0), DateTime.civil(2005, 2, 21, 10, 11, 12, 0).utc
assert_equal DateTime.civil(2005, 2, 21, 9, 11, 12, 0), DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(1, 24)).utc
+ assert_equal DateTime.civil(2005, 2, 21, 9, 11, 12, 0), DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(1, 24)).getutc
end
def test_formatted_offset_with_utc