diff options
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/calculations.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 1c9a3523a9..8247003ca3 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -87,7 +87,8 @@ module ActiveSupport #:nodoc: # Returns a new Time representing the "start" of this week (Monday, 0:00) def beginning_of_week - (self - self.wday.days).midnight + 1.day + days_to_monday = self.wday!=0 ? self.wday-1 : 6 + (self - days_to_monday.days).midnight end alias :monday :beginning_of_week alias :at_beginning_of_week :beginning_of_week |