rails: set datetime column using value in a text_field -


my question similar another one putting data text_field datetime column. appears need put data text_field in particular order or rails wont accept it. thing is, can't control how user input data. in fact, since added jquery datepicker value user puts in wrong.

i thought use date.parse or time.parse or datetime.parse along setter method (mentioned in railscast 32but doesn't seem working me either. keep getting argument out of range error seems due input being in wrong format.

does else use jquery datepicker fill in text field date? magic have add model or controller make work? why difficult?

i used timeliness gem overcome problem , submit date in format wanted. along timeliness used validates_timeliness validate date , time, is not in future or anything.

to parse string 'mm/dd/yyyy' using timeliness gem do:

timeliness.parse(params[:my_date], :format => 'mm/dd/yyyy') 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -