Reputation: 52500
I want to have a date input for a form. I know this only works in some browsers:
<input type="date" name="birth_day"/>
Is there a convenient method for this in Ruby on Rails? The documentation for the various form elements list many other input types, but I don't see anything for dates:
I know about date_select, that's not what I want. I want the above HTML output. I'm using Ruby on Rails 3.2.13. Is there possibly a date_field
in Ruby on Rails 4? Or another way to do this?
Upvotes: 12
Views: 26377
Reputation: 379
For older versions of Rails I believe you can use:
.text_field(type: 'date')
Upvotes: 5