私が開発しているアプリには、主に現在の日付を値として使用する日付セレクターがあります (または数日後の日付)。ユーザーの作業を軽減するために、今日の日付をデフォルト値として設定したいと考えています。
年は :
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
も変わりませんでした。私はどんな間違いをしていますか?
前もって感謝します