Class: FancyHash::Types::DateTime

Inherits:
ActiveModel::Type::DateTime
  • Object
show all
Defined in:
lib/fancy_hash.rb

Instance Method Summary collapse

Instance Method Details

#cast_value(value) ⇒ Object



137
138
139
140
141
142
# File 'lib/fancy_hash.rb', line 137

def cast_value(value)
  # Facil returns no timezone information, then it defaults to the OS timezone, which may be UTC in production
  value = "#{value}#{Time.zone.formatted_offset}" if value.is_a?(String) && value.size == 19

  super
end

#serialize(value) ⇒ Object



133
134
135
# File 'lib/fancy_hash.rb', line 133

def serialize(value)
  value&.iso8601
end