【问题标题】:Limiting datetime_select to a certain start time将 datetime_select 限制为某个开始时间
【发布时间】:2016-02-07 09:06:34
【问题描述】:

有没有办法限制 rails 中的 datetime_select 以便它只显示某些小时,例如所以唯一的选择是下午 5 点到 10 点?目前只有这个:`

<%= f.label :time %><br>
<%= f.datetime_select :time,  :minute_step => 30 %>`

【问题讨论】:

    标签: ruby-on-rails form-for datetime-select


    【解决方案1】:

    这将为您提供下午 5 点到 10 点之间的一个小时范围

    <%= f.datetime_select :time,  minute_step: 30, start_hour: 17, end_hour: 22 %>`
    

    【讨论】:

    • 太酷了...我以为 start_hourend_hour 仅适用于 select_timeselect_hour
    猜你喜欢
    • 2013-08-21
    • 2020-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-21
    • 2017-10-10
    • 1970-01-01
    • 2021-12-25
    相关资源
    最近更新 更多