Convert jQuery datetimepicker date and time format into a Rails DateTime format -
i need implement jquery datetimepicker ruby on rails 5 application. there documentation jqueryui date picker, included 2 railscasts ryan bates.
datetimepicker concerned, suppose concern rails produce date , time format rails can understand. once issue solved, think easy add plugin asset pipeline.
rails datetime format "yyyy-mm-dd hh:mm:ss". instance "2017-07-28 11:24:53".
wonder: there way change default datetimepicker format datetime rails format ?
in datetimepicker official webpage, section dedicated using date parser/formatter uses example momentjs library. not find examples useful rails applications.
jquery ui datepicker has dateformat option can used set date format desired format: how can done datetimepicker?
in view :
= form_for @event |f| = f.text_field :event_start, class: "datepicker" in controller
def create # before save @event.event_start = params[:event][:event_start].to_datetime end
Comments
Post a Comment