I currently have a form that let’s you set the date for an event. I am using the date_select form helper so I have 3 select drop downs.
I thought that maybe I could just switch it to a text_field and format the date and validate with a regex, but it seems I can only input it as dd/mm/yyyy. If I input 12/25/2012 for example – it returns an error (of blank, because I guess it doesn’t have another error type?) Can I get it to accept format as mm/dd/yyyy?
You can use
Date.parse(the_textfield), you don’t need to write your own regex.rdoc here on how it works:
http://apidock.com/ruby/Date/parse/class
You can add this as a before-save method in your model thus: