Date check
Hi guys I have a problem validating the date if it is not correct. If I search for a database entry for Feb 31st, it shows me an error on the server and it doesn't display anything. I don't know what to do, please ...
my code for storing my hash date
@start = "#{params[:start][:day]}-#{params[:start][:month]}-#{params[:start][:year]}"
and for passing is `@start_date = Date.parse (@start)
`and it returns immediately upon detecting that the past date is incorrect, and this prevents me from verifying it.
+1
source to share
2 answers
There's not a very good date check built into rails. You might want to try Jonathan Viney's "validates_date_time".
found here: http://svn.viney.net.nz/things/rails/plugins/validates_date_time/
+1
source to share