Sha256: ece8811c8a345d4e03a4dac34d3cc7059d462fafd2d18f2e24e9dfeca4bc8a4e

Contents?: true

Size: 246 Bytes

Versions: 1

Compression:

Stored size: 246 Bytes

Contents

class DateTimeFormatValidator < ActiveModel::EachValidator # :nodoc:
  def validate_each(record, attribute, value)
    DateTime.parse(value)
  rescue ArgumentError, TypeError
    record.errors.add(attribute, 'is not a DateTime format')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csv_row_model-1.0.0.beta2 lib/csv_row_model/validators/date_time_format_validator.rb