在我的应用程序中,我希望实现AM和PM功能。用户不应该自己输入。我有一个文本框,用户应该只输入数字我也想添加时间选择器。
%li
%label{:for => "start_time"}Start_time<em>*</em>
= f.text_field :start_time, :required => "required", :autofocus => true
%li
%label{:for => "end_time"}End_time<em>*</em>
= f.text_field :end_time, :required => "required", :autofocus => true
答案 0 :(得分:0)
实际上你可以使用time_select
方法&amp;做这样的事情:
time_select("event", "start_time", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})
time_select("event", "end_time", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})
希望它有所帮助!