codegram/date_validator — pull request #37 by robworley (2013-02-28 16:23:59+00:00)
Title: Consider expressions that cannot be type cast to be invalid

Useful for ActiveRecord models where string a value is assigned to using `Model#attributes=`. ActiveRecord will try to type cast the string to a date. When the type cast fails because the string cannot be parsed, it assigns nil to the attribute.

Prior to this change if you specified `:allow_nil => true` or `:allow_blank => true` it would incorrectly consider the attribute to be valid. I added some logic to check the value before type cast, taking care to preserve backwards compatibility.

It should resolve issue https://github.com/codegram/date_validator/issues/25. Hope it helps.