Sha256: 5544e0f5c9ee08a4525e8feed1d41f951edcb60384e67373edcd523acf6c180c
Contents?: true
Size: 622 Bytes
Versions: 12
Compression:
Stored size: 622 Bytes
Contents
module Valigator module CSV module FieldValidators class Date < Base def valid?(value) return true if allow_blank and blank? value parse value true rescue ArgumentError false end def error_type 'invalid_date' end def error_message 'Invalid date field' end private def format @options[:format] end def parse(value) format ? ::Date.strptime(value.to_s, format) : ::Date.parse(value.to_s) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems