Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GH #4883. Optional start_day argument for Time#all_week

  • Loading branch information...
commit 1d3ac985f4f02322891e771808b3cea96b6af9b4 1 parent 2bf2055
@kennyj authored
View
4 activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -274,8 +274,8 @@ def all_day
end
# Returns a Range representing the whole week of the current time.
- def all_week
- beginning_of_week..end_of_week
+ 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.
View
1  activesupport/test/core_ext/time_ext_test.rb
@@ -802,6 +802,7 @@ def test_all_day
def test_all_week
assert_equal Time.local(2011,6,6,0,0,0)..Time.local(2011,6,12,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_week
+ assert_equal Time.local(2011,6,5,0,0,0)..Time.local(2011,6,11,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_week(:sunday)
end
def test_all_month
Please sign in to comment.
Something went wrong with that request. Please try again.