adzap / validates_timeliness

Date and time validation plugin for ActiveModel and Rails. Supports multiple ORMs and allows custom date/time formats.
MIT License
1.59k stars 227 forks source link

before 18.years.ago does not validate with 2018/10/10 #181

Closed pke closed 5 years ago

pke commented 5 years ago

Today is 2018/11/19. My model has this validation:

validates :born_on, timeliness: { type: :date, before: lambda { 18.years.ago }}

But it fails when born_on is set to the date 2010/10/10, which would be 18 years ago.

pke commented 5 years ago

Upps. Nevermind, the input date was wrongly sent by the webform. All fine.