-1

I want to set my time select like this click here

I used = course_form.input :start_at, label: false and html show hour select in 1 input field and minute in another input field.

Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103

2 Answers2

2

check the datetime select api..

starts_at is datetime field
##migration file
t.datetime :starts_at

Simple code snippet can be like this with multiple configurations:-

<div class="form_group">
   <label>Start time:</label></br>
      <%= f.datetime_select :starts_at , :class=>"form-control",:start_year => Date.current.year, :end_year => Date.current.year,:selected=> Date.today, :order=> [:day, :month, :year],:start_year=> Time.now.year,:default=> 1.days.from_now,:prompt=> {day: 'Choose day', month: 'Choose month', year: 'Choose year'},:placeholder=>"Enter start time",:required=>true %>
</div>

hope it helps

Milind
  • 4,535
  • 2
  • 26
  • 58
0

Maybe you should try to use one of the timepickers. https://www.sitepoint.com/10-jquery-time-picker-plugins/

Alex Zakruzhetskyi
  • 1,383
  • 2
  • 22
  • 43