Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Date fields coerces invalid dates into valid dates which then passes validation #56

Open
xargoon opened this Issue · 0 comments

1 participant

xargoon
xargoon

When using (for example) this property in the model:

 property :birthday, Date, required: true
 validates_primitive_type_of :birthday

and f.date_select :birthday, start_year: Time.now.year, end_year: 1900, prompt: true in the view, Rails/DM will change an invalid date like Year=nil, Day=nil, Month=11 to 0001-11-01, which then passes validation. It's not possible to do a manual validation, since you don't get the raw data in the model.
Only if all of the date parameters birthday(1i), birthday(2i), birthday(3i) is nil will validation fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.