From 9c2b3b8008d9c97752aa33659369c02d6b0a87c1 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 9 Oct 2012 18:09:47 +0200 Subject: AS guide: revises the description of #monday, and #sunday [ci skip] The start of the week is a parameter nowadays, it is a little confusing that we say here that we assume something about it. Better to use "next" and "previous", which are clear regardless of the concept of beginning of week. Adds examples for the edge cases where the receiver is a Monday or Sunday itself. --- guides/source/active_support_core_extensions.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 1948cb0278..6a5d88777c 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -3112,13 +3112,19 @@ d.end_of_week(:sunday) # => Sat, 08 May 2010 ##### `monday`, `sunday` -The methods `monday` and `sunday` return the dates for the beginning and -end of the week, respectively. Weeks are assumed to start on Monday. +The methods `monday` and `sunday` return the dates for the previous Monday and +next Sunday, respectively. ```ruby d = Date.new(2010, 5, 8) # => Sat, 08 May 2010 d.monday # => Mon, 03 May 2010 d.sunday # => Sun, 09 May 2010 + +d = Date.new(2012, 9, 10) # => Mon, 10 Sep 2012 +d.monday # => Mon, 10 Sep 2012 + +d = Date.new(2012, 9, 16) # => Sun, 16 Sep 2012 +d.sunday # => Sun, 16 Sep 2012 ``` ##### `prev_week`, `next_week` -- cgit v1.2.3