Module: Canql::Nodes::YearQuarterNode
- Defined in:
- lib/canql/nodes/dates.rb
Instance Method Summary collapse
Instance Method Details
#to_daterange ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/canql/nodes/dates.rb', line 26 def to_daterange quarter = text_value[0..1] year = text_value[3..] quarters = { q1: "01-04-#{year}", q2: "01-07-#{year}", q3: "01-10-#{year}", q4: "01-01-#{year.to_i + 1}" } Daterange.new(quarters[quarter.to_sym].to_date, quarters[quarter.to_sym].to_date + 3.months - 1.day) end |