class YAHL7::V2::DataType::DT
This is the HL7 data type for a single date. This should be in the format of YYYY[MM]
Public Instance Methods
date()
click to toggle source
# File lib/yahl7/v2/data_type/dt.rb, line 11 def date @date ||= parse_date end
Private Instance Methods
parse_date()
click to toggle source
# File lib/yahl7/v2/data_type/dt.rb, line 17 def parse_date case @value.length when 4 then Date.parse("#{@value}0101") when 6 then Date.parse("#{@value}01") when 8 then Date.parse(@value) else raise YAHL7::V2::Error::InvalidFormatError, 'Unknown date format' end end