Closed pisaruk closed 8 years ago
Got the same issues now. Wrong dates as strings like "10.100.2014" are not recognized.
Possible dirty fix could be a validator like this
begin
if date.is_a?(String)
date = date.to_date
end
rescue Exception => e
errors.add(:date, "invalid date")
end
I found two situations where it fails to find errors, and I created two test cases to exhibit the problem:
I could not manage to fix them but, for fixing the second case I would start looking at: https://github.com/codegram/date_validator/blob/master/lib/active_model/validations/date_validator.rb#L87.
"not_a_date".to_i
and
50.years.ago.to_i