Class: Relaton::Bib::PlainDate

Inherits:
Lutaml::Model::Type::Date
  • Object
show all
Defined in:
lib/relaton/bib/model/type/plain_date.rb

Overview

xs:date value type that always casts to ::Date, dropping any time and timezone component. Without this, lutaml-model’s built-in Date type promotes inputs like “2018-04-15T00:00:00Z” to ::DateTime and serializes them back as “2018-04-15Z” — valid xs:date, but not valid ISO 8601.

Class Method Summary collapse

Class Method Details

.cast(value, options = {}) ⇒ Object



10
11
12
13
# File 'lib/relaton/bib/model/type/plain_date.rb', line 10

def self.cast(value, options = {})
  result = super
  result.is_a?(::DateTime) ? result.to_date : result
end