Changeset 5363
- Timestamp:
- 10/24/06 23:35:27 (2 years ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/core_ext/time/calculations.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/time_ext_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r5334 r5363 1 1 *SVN* 2 3 * next_week respects DST changes. #6483 [marclove] 2 4 3 5 * Expose methods added to Enumerable in the documentation, such as group_by. Closes #6170. [sergeykojin@gmail.com, Marcel Molina Jr.] trunk/activesupport/lib/active_support/core_ext/time/calculations.rb
r4312 r5363 136 136 def next_week(day = :monday) 137 137 days_into_week = { :monday => 0, :tuesday => 1, :wednesday => 2, :thursday => 3, :friday => 4, :saturday => 5, :sunday => 6} 138 since(1.week).beginning_of_week.since(days_into_week[day].day).change(:hour => 0) 138 # Adjust in case of switches to or from daylight savings time 139 week_from_today = self.since(1.week) + (self.since(1.week) <=> self).hour 140 week_from_today.beginning_of_week.since(days_into_week[day].day).change(:hour => 0) 139 141 end 140 142 trunk/activesupport/test/core_ext/time_ext_test.rb
r4595 r5363 147 147 assert_equal Time.local(2005,2,29), Time.local(2005,2,22,15,15,10).next_week(:tuesday) 148 148 assert_equal Time.local(2005,3,4), Time.local(2005,2,22,15,15,10).next_week(:friday) 149 assert_equal Time.local(2006,10,30), Time.local(2006,10,23,0,0,0).next_week 150 assert_equal Time.local(2006,11,1), Time.local(2006,10,23,0,0,0).next_week(:wednesday) 149 151 end 150 152