Sha256: 7f8548d3a1d668b81674ef9920389cdd400b1e9d428e1868279a034a1f095f90
Contents?: true
Size: 1.75 KB
Versions: 5
Compression:
Stored size: 1.75 KB
Contents
# FGDC <<Class>> DateSingle # FGDC CSDGM writer output in XML # History: # Stan Smith 2018-01-19 convert ISO date formats to FGDC # Stan Smith 2017-11-23 original script require 'adiwg/mdtranslator/internal/module_dateTimeFun' module ADIWG module Mdtranslator module Writers module Fgdc class DateSingle def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj end def writeXML(hDate) sDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:dateTime], hDate[:dateResolution]) sTime = AdiwgDateTimeFun.stringTimeFromDateTime(hDate[:dateTime], hDate[:dateResolution]) # convert ISO date format to FGDC sDate.gsub!(/[-]/,'') # single date 9.1 (sngdate) - single date (required) @xml.tag!('sngdate') do # single date 9.1.1 (caldate) - calendar date unless sDate == 'ERROR' @xml.tag!('caldate', sDate) end if sDate == 'ERROR' @hResponseObj[:writerPass] = false @hResponseObj[:writerMessages] << 'single date is missing or invalid' end # single date 9.1.2 (time) - time unless sTime == 'ERROR' @xml.tag!('time', sTime) end if sTime == 'ERROR' && @hResponseObj[:writerShowTags] @xml.tag!('time') end end end # writeXML end # SingleDate end end end end
Version data entries
5 entries across 5 versions & 1 rubygems