Sha256: ba48cf6323a33970163177ed3fefcbb7bf11290b266b8fcd3c3b5d916122da8c

Contents?: true

Size: 781 Bytes

Versions: 32

Compression:

Stored size: 781 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module CipherStashPG
      module OID # :nodoc:
        class TimestampWithTimeZone < DateTime # :nodoc:
          def type
            real_type_unless_aliased(:timestamptz)
          end

          def cast_value(value)
            return if value.blank?

            time = super
            return time unless time.acts_like?(:time)

            # While in UTC mode, the PG gem may not return times back in "UTC" even if they were provided to Postgres in UTC.
            # We prefer times always in UTC, so here we convert back.
            if is_utc?
              time.getutc
            else
              time.getlocal
            end
          end
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
activerecord-cipherstash-pg-adapter-0.8.5 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.8.4 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.8.3 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.8.2 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.8.1 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.8.0 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.19 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.18 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.17 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.16 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.15 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.14 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.12 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.11 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.10 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.9 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.8 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.7 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.6 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
activerecord-cipherstash-pg-adapter-0.7.5 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb