Changeset 8732
- Timestamp:
- 01/26/08 00:34:44 (8 months ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/time_with_zone.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/time_with_zone_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r8731 r8732 1 1 *SVN* 2 3 * TimeWithZone#- added, so that #- can handle a Time or TimeWithZone argument correctly [Geoff Buesing] 2 4 3 5 * with_timezone test helper renamed with_env_tz, to distinguish between setting ENV['TZ'] and setting Time.zone in tests [Geoff Buesing] trunk/activesupport/lib/active_support/time_with_zone.rb
r8720 r8732 107 107 utc <=> other 108 108 end 109 110 # Need to override #- to intercept situation where a Time or Time With Zone object is passed in 111 # Otherwise, just pass on to method missing 112 def -(other) 113 other.acts_like?(:time) ? utc - other : method_missing(:-, other) 114 end 109 115 110 116 # A TimeProxy acts like a Time, so just return self trunk/activesupport/test/core_ext/time_with_zone_test.rb
r8730 r8732 125 125 def test_minus_with_time 126 126 assert_equal 86_400.0, ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 2), TimeZone['UTC'] ) - Time.utc(2000, 1, 1) 127 assert_equal 86_400.0, ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 2), TimeZone['Hawaii'] ) - Time.utc(2000, 1, 1) 127 128 end 128 129