Permalink
Browse files

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.
  • Loading branch information...
fxn committed Oct 9, 2012
1 parent 64dd071 commit 9c2b3b8008d9c97752aa33659369c02d6b0a87c1
Showing with 8 additions and 2 deletions.
  1. +8 −2 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`

0 comments on commit 9c2b3b8

Please sign in to comment.