在我正在开发的应用程序中,我有一个日期选择器,它主要用于当前日期作为值(或几天后的日期)。为了减少用户的工作,我想将今天的日期设置为默认值。
我可以很容易地设置年份:
date_select f, :date, class="form_control", year: [options: @current_year, @current_year+1]
,但没有设法为月份和日期做类似的事情。
我尝试将代码更改为date_select f, :date, class="form_control", year: [options: @current_year, @current_year+1], month: [default: 2]
,
date_select f, :date, class="form_control", year: [options: @current_year, @current_year+1], month: [default: "2"]
,
date_select f, :date, class="form_control", year: [options: @current_year, @current_year+1], month: [default: "02"]
,但这些都不起作用。替换default
为value
没有任何区别。我犯了什么错误?
提前致谢