不考虑输入的简单形式 HTML

Simple Form Not Respecting Input HTML

所以我有下面一行:

<%= f.input :birth_date, as: :date, label: "Date of Birth", html5: true, input_html: {min: Time.now.year - 100.year, max: Time.now} %>

正在生成:

<input class="form-Field-control date required dr-FormField-control" aria-invalid="true" name="recommends_insurance_term_life_referral[birth_date]" id="recommends_insurance_term_life_referral_birth_date" type="date">

关于我没有考虑的任何想法?

作为最小值和最大值,您必须传递一个 Date 对象。

Date.today - 100.years