Ruby on Rails datepicker

Jun. 29, 2016

Ruby on Rails datepicker

Use bootstrap datepicker gem

Gemfile:

gem 'bootstrap-datepicker-rails'

Add this line to app/assets/stylesheets/application.scss

 *= require bootstrap-datepicker3

Add this line to app/assets/javascripts/application.js

//= require bootstrap-datepicker

Add this line to template

<%= f.text_field :publish_at, "data-provide" => 'datepicker', "data-date-format" => "yyyy-mm-dd" %>