Sha256: 251da9f185a6e4715373c5b84672d0ad0ef81bccb436fcb0fcfe32af03d5cc29

Contents?: true

Size: 372 Bytes

Versions: 60

Compression:

Stored size: 372 Bytes

Contents

# frozen_string_literal: true

# This validator ensures timezones are valid. This is, supported by ActiveSupport::TimeZone
class TimeZoneValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    return if value.blank?

    record.errors.add(attribute, options[:message] || :invalid_time_zone) unless ActiveSupport::TimeZone[value]
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/validators/time_zone_validator.rb
decidim-core-0.28.4 app/validators/time_zone_validator.rb
decidim-core-0.27.9 app/validators/time_zone_validator.rb
decidim-core-0.29.0 app/validators/time_zone_validator.rb
decidim-core-0.28.3 app/validators/time_zone_validator.rb
decidim-core-0.27.8 app/validators/time_zone_validator.rb
decidim-core-0.29.0.rc4 app/validators/time_zone_validator.rb
decidim-core-0.29.0.rc3 app/validators/time_zone_validator.rb
decidim-core-0.29.0.rc2 app/validators/time_zone_validator.rb
decidim-core-0.29.0.rc1 app/validators/time_zone_validator.rb
decidim-core-0.28.2 app/validators/time_zone_validator.rb
decidim-core-0.27.7 app/validators/time_zone_validator.rb
decidim-core-0.28.1 app/validators/time_zone_validator.rb
decidim-core-0.27.6 app/validators/time_zone_validator.rb
decidim-core-0.26.10 app/validators/time_zone_validator.rb
decidim-core-0.26.9 app/validators/time_zone_validator.rb
decidim-core-0.28.0 app/validators/time_zone_validator.rb
decidim-core-0.27.5 app/validators/time_zone_validator.rb
decidim-core-0.28.0.rc5 app/validators/time_zone_validator.rb
decidim-core-0.28.0.rc4 app/validators/time_zone_validator.rb