Skip to main content

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

Rails • Asked by Neil Patel

Hello

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..


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.