Sha256: f2c9036af734a2a1f99d4e85c3b5fe14da289bc3b15ef8b141d3680697d62b3b

Contents?: true

Size: 265 Bytes

Versions: 2

Compression:

Stored size: 265 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
csv_row_model-1.0.0.beta1 lib/csv_row_model/validators/date_time_format.rb
csv_row_model-0.4.1 lib/csv_row_model/validators/date_time_format.rb