method
prev_occurring
v8.0.0 -
Show latest stable
- Class:
DateAndTime::Calculations
prev_occurring(day_of_week)public
Returns a new date/time representing the previous occurrence of the specified day of week.
today = Date.today # => Thu, 14 Dec 2017 today.prev_occurring(:monday) # => Mon, 11 Dec 2017 today.prev_occurring(:thursday) # => Thu, 07 Dec 2017