Class: Timing::NaturalTimeLanguage::YearMonthDay

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/timing/natural_time_language_interpreters.rb

Instance Method Summary collapse

Instance Method Details

#evaluate(zone_offset) ⇒ Object



107
108
109
110
111
112
113
# File 'lib/timing/natural_time_language_interpreters.rb', line 107

def evaluate(zone_offset)
  now = TimeInZone.now zone_offset
  yyyy = year.value
  mm = month.value.to_s.rjust(2, '0')
  dd = day.value.to_s.rjust(2, '0')
  TimeInZone.parse "#{yyyy}-#{mm}-#{dd} 00:00:00 #{now.zone_offset}"
end