Changeset 8697
- Timestamp:
- 01/23/08 02:11:00 (4 months ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/values/time_zone.rb (modified) (1 diff)
- trunk/activesupport/test/time_zone_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r8696 r8697 1 1 *SVN* 2 3 * Adding alternate_utc_string option to TimeZone#formatted_offset. Removing unneeded TimeZone#offset. [Geoff Buesing] 2 4 3 5 * Introduce ActiveSupport::TimeWithZone, for wrapping Time instances with a TimeZone. Introduce instance methods to Time for creating TimeWithZone instances, and class methods for managing a global time zone. [Geoff Buesing] trunk/activesupport/lib/active_support/values/time_zone.rb
r8679 r8697 157 157 158 158 # Returns the offset of this time zone as a formatted string, of the 159 # format "+HH:MM". If the offset is zero, this returns the empty160 # string. If +colon+ is false, a colon will not be inserted into the161 # result.162 def formatted_offset(colon=true)163 utc_offset == 0 ? '' : offset(colon)164 end165 166 # Returns the offset of this time zone as a formatted string, of the167 159 # format "+HH:MM". 168 def offset(colon=true)169 utc_offset .to_utc_offset_s(colon)160 def formatted_offset(colon=true, alternate_utc_string = nil) 161 utc_offset == 0 && alternate_utc_string || utc_offset.to_utc_offset_s(colon) 170 162 end 171 163 trunk/activesupport/test/time_zone_test.rb
r8679 r8697 78 78 end 79 79 80 def test_formatted_offset_zero 81 zone = TimeZone['London'] 82 assert_equal "+00:00", zone.formatted_offset 83 assert_equal "UTC", zone.formatted_offset(true, 'UTC') 84 end 85 80 86 def test_zone_compare 81 87 zone1 = TimeZone['Central Time (US & Canada)'] # offset -0600