Sha256: a8bd797b922865a2a4ab3a1164d29c53a213a93b47183af6a3f7bd072dfcad05
Contents?: true
Size: 572 Bytes
Versions: 35
Compression:
Stored size: 572 Bytes
Contents
# frozen_string_literal: true module ActiveJob module Serializers class TimeWithZoneSerializer < ObjectSerializer # :nodoc: NANO_PRECISION = 9 def serialize(time_with_zone) super( "value" => time_with_zone.iso8601(NANO_PRECISION), "time_zone" => time_with_zone.time_zone.tzinfo.name ) end def deserialize(hash) Time.iso8601(hash["value"]).in_time_zone(hash["time_zone"] || Time.zone) end private def klass ActiveSupport::TimeWithZone end end end end
Version data entries
35 entries across 35 versions & 5 rubygems