Jie Ma bio photo

Jie Ma

web developer, freelance photographer

Twitter LinkedIn Instagram Github Weibo Flickr

Ruby on Rails datepicker

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" %>