Sha256: 731a34f5170acc4aa7f53cb23b552ec1d40f9e79c4c72db796adb7262f0f1a15
Contents?: true
Size: 415 Bytes
Versions: 1
Compression:
Stored size: 415 Bytes
Contents
module Superstore module Types class TimeType < ActiveModel::Type::Value def serialize(time) time.utc.xmlschema(6) if time end def deserialize(str) Time.rfc3339(str).in_time_zone if str rescue ArgumentError Time.parse(str).in_time_zone rescue nil end def cast_value(value) value.to_time.in_time_zone rescue nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
superstore-2.5.0 | lib/superstore/types/time_type.rb |