Module: Unidata::Extensions::Date

Included in:
Date
Defined in:
lib/unidata/extensions/date.rb

Constant Summary collapse

PICK_DAY_ZERO =
::Date.parse('1967-12-31')

Instance Method Summary collapse

Instance Method Details

#from_unidata(value) ⇒ Object



16
17
18
# File 'lib/unidata/extensions/date.rb', line 16

def from_unidata(value)
  PICK_DAY_ZERO + value.to_i
end

#to_unidata(value) ⇒ Object



12
13
14
# File 'lib/unidata/extensions/date.rb', line 12

def to_unidata(value)
  (value - PICK_DAY_ZERO).to_i
end

#typecast(value) ⇒ Object



8
9
10
# File 'lib/unidata/extensions/date.rb', line 8

def typecast(value)
  value.kind_of?(::Date) ? value : value.send(:to_date)
end