aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_support_core_extensions.md
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-10-09 18:09:47 +0200
committerXavier Noria <fxn@hashref.com>2012-10-09 18:09:52 +0200
commit9c2b3b8008d9c97752aa33659369c02d6b0a87c1 (patch)
treee538d8eefbc11230897a6bcab06898571c219e85 /guides/source/active_support_core_extensions.md
parent64dd0710206fd496f1dd486d22705034be83baf1 (diff)
downloadrails-9c2b3b8008d9c97752aa33659369c02d6b0a87c1.tar.gz
rails-9c2b3b8008d9c97752aa33659369c02d6b0a87c1.tar.bz2
rails-9c2b3b8008d9c97752aa33659369c02d6b0a87c1.zip
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.
Diffstat (limited to 'guides/source/active_support_core_extensions.md')
-rw-r--r--guides/source/active_support_core_extensions.md10
1 files changed, 8 insertions, 2 deletions
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`