Sha256: 698542064c9a193a42a465e914656f2342e3f256a78c407b96cc8bea74c8e535
Contents?: true
Size: 349 Bytes
Versions: 41
Compression:
Stored size: 349 Bytes
Contents
module DateAndTime module Calculations # Polyfill, already implemented on Rails 5.2 # https://api.rubyonrails.org/classes/DateAndTime/Calculations.html#method-i-prev_occurring def prev_occurring(day_of_week) ago = wday - DAYS_INTO_WEEK.fetch(day_of_week) ago += 7 unless ago > 0 advance(days: -ago) end end end
Version data entries
41 entries across 41 versions & 1 rubygems