Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

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

Open
kjler opened this issue May 21, 2012 · 0 comments

Comments

@kjler
Copy link

kjler commented May 21, 2012

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant