Skip to content

Commit

Permalink
Adds Time#sunday method
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaydev committed Nov 26, 2011
1 parent a8f2860 commit 80ac4dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ def end_of_week(start_day = :monday)
end
alias :at_end_of_week :end_of_week

# Returns a new +Date+/+DateTime+ representing the end of this week. Week is
# assumed to start on a Monday. +DateTime+ objects have their time set to 23:59:59.
def sunday
end_of_week
end

# Returns a new Time representing the start of the given day in the previous week (default is :monday).
def prev_week(day = :monday)
ago(1.week).beginning_of_week.since(DAYS_INTO_WEEK[day].day).change(:hour => 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3455,6 +3455,7 @@ end_of_day
beginning_of_week (at_beginning_of_week)
end_of_week (at_end_of_week)
monday
sunday
weeks_ago
prev_week
next_week
Expand Down

0 comments on commit 80ac4dc

Please sign in to comment.