我有两个属性start_time
和end_time
.
我如何使用输入的日期(不包括时间)start_time
来包含在end_time
字段中(因为开始+结束时间将发生在同一天,所以提示用户输入两次是没有意义的)。
看法:
<div class="day">
<div class="field">
<%= f.label :start_time, "Date" %>
<%= f.date_select :start_time,:default => Time.now+1.week, :order => [:month, :day, :year], :ampm => true %>
</div>
<div class="field">
<%= f.label :start_time, "Start Time" %>
<%= f.time_select :start_time, :ignore_date => true, :minute_step => 15, :ampm => true, :default => Time.now.beginning_of_day + 9.hours %>
</div>
<div class="field">
<%= f.label :end_time, "End Time" %>
<%= f.time_select :end_time, :minute_step => 15, :ampm => true, :default => Time.now.beginning_of_day + 15.hours %>
</div>
<%= link_to_function "Remove this day", "remove_fields(this)" %>
</div>
任何帮助,将不胜感激。