Ask A Question


You’re not receiving notifications from this thread.

How do I add a default time of 6:45pm to simple form / DatePicker

Neil Patel asked in Rails


Folllowing on from the prev 2 posts , How do i add the default time of 645pm in the form. So when someone craates the form a default time of 645 is already setup. I am using simple form and datepicker.

At the moment I have this code which gives the current time and date (date is ok but want to change time to 645)

had a look at stackoveflow , simple form gem and datepicker but cannot resolve

i was thinking of using something like default: '645'

= f.input :started_at, as: :string, class: 'form-control', input_html: { value: l(@happening.started_at, format: :date_time_picker), class: 'date_time_picker' }, label: "Start at"


would also like to know rails 5 bootstrapv4 simple_form datetimepicker solution..

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 78,890+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.