Module: Canql::Nodes::ChronicDateNode

Defined in:
lib/canql/nodes/dates.rb

Instance Method Summary collapse

Instance Method Details

#to_daterangeObject



51
52
53
54
55
56
57
58
# File 'lib/canql/nodes/dates.rb', line 51

def to_daterange
  chronic = Chronic.parse(text_value.to_s, guess: false)
  if chronic.instance_of?(Chronic::Span)
    Daterange.new(chronic.begin, chronic.end - 1.day)
  else
    Daterange.new(chronic)
  end
end