aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2012-02-05 07:14:47 -0800
committerSantiago Pastorino <santiago@wyeworks.com>2012-02-05 07:14:47 -0800
commit93f5361957028f4dc55d1f50fdebe3401aa22d98 (patch)
treef459da106c7810b1becad2656efa0f4cb4583e43 /activesupport/lib
parent2bf2055f7a856af0da17473e55ad2bcc5c69b02a (diff)
parentb0374018c2f0b334c18ca80eb8ba94358f13e576 (diff)
downloadrails-93f5361957028f4dc55d1f50fdebe3401aa22d98.tar.gz
rails-93f5361957028f4dc55d1f50fdebe3401aa22d98.tar.bz2
rails-93f5361957028f4dc55d1f50fdebe3401aa22d98.zip
Merge pull request #4890 from kennyj/improvement_4883
GH #4883. Optional start_day argument for Time#all_week
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index f3235d11bb..cfb835a3a5 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -273,9 +273,9 @@ class Time
beginning_of_day..end_of_day
end
- # Returns a Range representing the whole week of the current time.
- def all_week
- beginning_of_week..end_of_week
+ # Returns a Range representing the whole week of the current time. Week starts on start_day (default is :monday, i.e. end of Sunday).
+ def all_week(start_day = :monday)
+ beginning_of_week(start_day)..end_of_week(start_day)
end
# Returns a Range representing the whole month of the current time.