Class: Codabel::Type::Date
- Inherits:
-
Codabel::Type
- Object
- Codabel::Type
- Codabel::Type::Date
- Defined in:
- lib/codabel/type/date.rb
Instance Method Summary collapse
Methods inherited from Codabel::Type
Instance Method Details
#to_coda(value, length) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/codabel/type/date.rb', line 4 def to_coda(value, length) check!(length == 6, 'Length of 6 expected') return '0' * length if value.nil? value = ::Date.parse(value) if value.is_a?(String) value = value.to_date if value.respond_to?(:to_date) value.strftime('%d%m%y') end |