Sha256: ac10d88cc0a69dba0f71a2d8f1024e879785c3a084553c398604c299faf0e7e1

Contents?: true

Size: 1.88 KB

Versions: 2

Compression:

Stored size: 1.88 KB

Contents

= DateTimePicker

A library allows to select date and time, which uses jQuery UI.

== Requirements

You should have +jquery-rails+ gem installed and require +jquery+ and +jquery-ui+ assets (don't forget to require CSS for your jQuery UI).

== Installation

Add this to your Gemfile and run the +bundle+ command

  gem 'date_time_picker'

Run generator to create initializer

  rails generate date_time_picker

or create file manually and activate date_time_picker inside an initializer:

  DateTimePicker.activate :simple_form

You can pass only :simple_form to the activate method.

== I18n

By default plugin includes most using locales and you can require them from your application.js or using the helper, but if you want to add your locales 
or/and change one of them, then just put them into your assets dir.

== Usage

To add necessary assets add into your head

  <%= date_time_picker_assets %>

Or you can add them manually by requiring +date_time_picker+ and +date_time_picker_locale+
  
To use the picker inside the form

  <%= f.date_time_picker :datetime %>

To use it outside the form

  <%= date_time_picker :datetime %>

To specify special options add them into the end

  <%= t.date_time_picker :datetime, :id => 'input_id', :class => [:class_1, :class_2], :ampm => true %>

The full list of available options you can find on the {jQuery UI Datepicker docs}[http://docs.jquery.com/UI/Datepicker] and {jQuery UI Timepicker}[http://trentrichardson.com/examples/timepicker/].

By default plugin uses app locale, but if you want to specify it manually you can do this

  <%= t.date_time_picker :datetime, :locale => :ru %>

Also available

  <%= date_picker :date_only %>

  <%= time_picker :time_only %>

== SimpleForm support

To use the picker inside the form 

  <%= f.input :created_at, as: :ui_date_time %>

Also available

  <%= f.input :created_at, as: :ui_date %>

  <%= f.input :created_at, as: :ui_time %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
date_time_picker-0.5.9 README.rdoc
date_time_picker-0.5.6 README.rdoc