如何降序显示日期 select 中的年份?
how to display years in date select descendingly?
如何按降序显示年份?目前,我有这个:
<%= f.input :year_started, as: :date, label: "Date started", start_year: Date.today.year - 100, end_year: Date.today.year, discard_day: true, order: [:month, :year], include_blank: true, default: nil, :input_html => { :class => 'profile-date' } %>
下拉年份显示如下:
1900
1901
1902
....
2015
我想要相反的,你是怎么做到的?:
2015
2014
2013
....
1900
谢谢。
我认为这就像交换 start_year 和 end_year 一样简单。
尝试:
<%= f.input :year_started, as: :date, label: "Date started", start_year: Date.today.year, end_year: Date.today.year - 100, discard_day: true, order: [:month, :year], include_blank: true, default: nil, :input_html => { :class => 'profile-date' } %>
如何按降序显示年份?目前,我有这个:
<%= f.input :year_started, as: :date, label: "Date started", start_year: Date.today.year - 100, end_year: Date.today.year, discard_day: true, order: [:month, :year], include_blank: true, default: nil, :input_html => { :class => 'profile-date' } %>
下拉年份显示如下:
1900
1901
1902
....
2015
我想要相反的,你是怎么做到的?:
2015
2014
2013
....
1900
谢谢。
我认为这就像交换 start_year 和 end_year 一样简单。
尝试:
<%= f.input :year_started, as: :date, label: "Date started", start_year: Date.today.year, end_year: Date.today.year - 100, discard_day: true, order: [:month, :year], include_blank: true, default: nil, :input_html => { :class => 'profile-date' } %>