adzap/validates_timeliness

Handle when the passed value is not a Date value. when it's a Numeric

eng-Abdurhman opened this issue ยท 0 comments

When the passed value is not a date. when it is a Numeric, then we get the following exception ๐Ÿ‘‡
=> NoMethodError: undefined method "to_date" for 444:Integer


Example:
# app/models/item.rb

validates_date :expire_date

# console:

> item = Item.new(expire_date: 444)
> item.valid?
NoMethodError: undefined method `to_date' for 444:Integer

Can anyone help with this?


The suggested fix to handle Numeric values is: #229