I'm using Simple Forms in Rails 4.2. I have the following date selector for birth dates on my form page. I want to display the months in the selector drop down list in the following format, 1-January
, 2-February
, 3-March
... Instead of January
, February
, March
. How can I do this?
<%= f.input :birth_date, as: :date, start_year: Time.now.year - 15, end_year: Time.now.year - 75,
order: [:month, :day, :year], default: nil, label: false, include_blank: true,
input_html: { style: 'margin: 15px 0px; display: inline-block; width: 110px;' } %>
通过应用以下两个选项之一,可以获得所需的结果:
add_month_numbers: true
month_format_string: "%<number>02d-%{name}"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.