class ActiveModel::Validations::StringDateValidator

Public Instance Methods

validate_each(record, attr_name, value) click to toggle source
# File lib/strongest_validations/string_date_validator.rb, line 5
def validate_each(record, attr_name, value)
  record.errors.add(attr_name, :string_date, options) if !str_date_valid?(value)
end

Private Instance Methods

str_date_valid?(str_date) click to toggle source
# File lib/strongest_validations/string_date_validator.rb, line 10
def str_date_valid?(str_date)
  return begin
    str_date.in_time_zone
    true
  rescue => e
    false
  end
end