module CalendariumRomanum::Temporale::DateHelper
Provides utility methods for date arithmetics, available both as mixin instance methods and module methods.
@since 0.9.0
Constants
- WEEKDAYS
@api private
Public Instance Methods
octave_of(date)
click to toggle source
@param date [Date] @return [Date]
# File lib/calendarium-romanum/temporale/date_helper.rb, line 36 def octave_of(date) date + WEEK end
weekday_after(weekday, date)
click to toggle source
(see .weekday_before)
# File lib/calendarium-romanum/temporale/date_helper.rb, line 24 def weekday_after(weekday, date) if date.wday == weekday date + WEEK elsif weekday > date.wday date + (weekday - date.wday) else date + (WEEK - date.wday + weekday) end end
weekday_before(weekday, date)
click to toggle source
@param weekday [Integer] @param date [Date] @return [Date]
# File lib/calendarium-romanum/temporale/date_helper.rb, line 13 def weekday_before(weekday, date) if date.wday == weekday date - WEEK elsif weekday < date.wday date - (date.wday - weekday) else date - (date.wday + WEEK - weekday) end end