Sha256: 8b14c0daaec6bdffd78095ba693ea86901a18c0db34be6d0eedb3ab4b7e3d4eb
Contents?: true
Size: 568 Bytes
Versions: 126
Compression:
Stored size: 568 Bytes
Contents
# frozen_string_literal: true class ReeDate::BeginningOfQuarter include Ree::FnDSL fn :beginning_of_quarter do link :today link :change link :beginning_of_month end doc(<<~DOC) Returns a new date at the start of the quarter. today = Date.today # => Fri, 10 Jul 2015 today.beginning_of_quarter # => Wed, 01 Jul 2015 DOC contract(Nilor[Date] => Date) def call(date = nil) date = date || today first_quarter_month = date.month - (2 + date.month) % 3 change(date, day: 1, month: first_quarter_month) end end
Version data entries
126 entries across 126 versions & 1 rubygems