Sha256: 4d58dd007f0ac63a4486cb28d415cd5de075fe8ab88014e8eb70f521bfeb10d5

Contents?: true

Size: 424 Bytes

Versions: 20

Compression:

Stored size: 424 Bytes

Contents

# frozen_string_literal: true

require "active_support/core_ext/time/zones"

module ActiveModel
  module Type
    module Helpers # :nodoc: all
      module Timezone
        def is_utc?
          if default = ::Time.zone_default
            default.name == "UTC"
          else
            true
          end
        end

        def default_timezone
          is_utc? ? :utc : :local
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
activemodel-8.0.1 lib/active_model/type/helpers/timezone.rb
activemodel-8.0.0.1 lib/active_model/type/helpers/timezone.rb
activemodel-7.2.2.1 lib/active_model/type/helpers/timezone.rb
activemodel-8.0.0 lib/active_model/type/helpers/timezone.rb
activemodel-7.2.2 lib/active_model/type/helpers/timezone.rb
activemodel-8.0.0.rc2 lib/active_model/type/helpers/timezone.rb
activemodel-7.2.1.2 lib/active_model/type/helpers/timezone.rb
activemodel-8.0.0.rc1 lib/active_model/type/helpers/timezone.rb
activemodel-7.2.1.1 lib/active_model/type/helpers/timezone.rb
activemodel-8.0.0.beta1 lib/active_model/type/helpers/timezone.rb
omg-activemodel-8.0.0.alpha9 lib/active_model/type/helpers/timezone.rb
omg-activemodel-8.0.0.alpha8 lib/active_model/type/helpers/timezone.rb
omg-activemodel-8.0.0.alpha7 lib/active_model/type/helpers/timezone.rb
omg-activemodel-8.0.0.alpha4 lib/active_model/type/helpers/timezone.rb
omg-activemodel-8.0.0.alpha3 lib/active_model/type/helpers/timezone.rb
omg-activemodel-8.0.0.alpha2 lib/active_model/type/helpers/timezone.rb
omg-activemodel-8.0.0.alpha1 lib/active_model/type/helpers/timezone.rb
activemodel-7.2.1 lib/active_model/type/helpers/timezone.rb
activemodel-7.2.0 lib/active_model/type/helpers/timezone.rb
activemodel-7.2.0.rc1 lib/active_model/type/helpers/timezone.rb