Module: HankeHenryDate::Module
Overview
This module is used for extending Date and DateTime classes to include class method .hh
that takes arguments representing Hanke-Henry calendar dates and returns Date and DateTime objects.
Instance Method Summary collapse
Instance Method Details
#hh(*args) ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/hanke-henry/hanke_henry_date.rb', line 77 def hh(*args) hh_year, hh_month, hh_day, hour, minute, second = _validate(*args) julian = _to_julian_date(hh_year, hh_month, hh_day) if self.ancestors.include? DateTime d = DateTime.jd julian DateTime.new(d.year, d.month, d.day, hour, minute, second) else Date.jd julian end end |