Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amend next_week documentation #20049

Merged
merged 1 commit into from
May 7, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def beginning_of_year
# The +given_day_in_next_week+ defaults to the beginning of the week
# which is determined by +Date.beginning_of_week+ or +config.beginning_of_week+
# when set. +DateTime+ objects have their time set to 0:00 unless +same_time+ is true.
#
# ==== Examples
# today = Date.today # => Thu, 07 May 2015
# today.next_week # => Mon, 11 May 2015
#
# now = Time.current # => Thu, 07 May 2015 13:31:16 UTC +00:00
# now.next_week(:friday) # => Fri, 15 May 2015 00:00:00 UTC +00:00
def next_week(given_day_in_next_week = Date.beginning_of_week, same_time: false)
result = first_hour(weeks_since(1).beginning_of_week.days_since(days_span(given_day_in_next_week)))
same_time ? copy_time_to(result) : result
Expand Down