How can I generate input[type=date] with simple_form?

断了今生、忘了曾经 提交于 2019-12-04 09:15:38

You should specify html5 option:

f.input :start_date, as: :date, html5: true

Here is details.

HTML 5 date / time inputs are not generated by Simple Form by default, so using date, time or datetime will all generate select boxes using normal Rails helpers. We believe browsers are not totally ready for these yet, but you can easily opt-in on a per-input basis by passing the html5 option:

<%= f.input :expires_at, as: :date, html5: true %>

Hopefully this piece of information found in simple_form documentation will solve your problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!