DatetimeSplitter
Splits datetime field into date & time fields
Installation
Add this line to your application's Gemfile:
gem 'datetime_splitter'
And then execute:
$ bundle
Or install it yourself as:
$ gem install datetime_splitter
Usage
class Foo < ActiveRecord::Base
extend DatetimeSplitter
split_datetime :created_at, date_format: '%d/%m/%Y', time_format: '%H:%M:%S'
end
You'll get accessor methods to use in forms
Foo.new.created_at_date
Foo.new.created_at_date=
Foo.new.created_at_time
Foo.new.created_at_time=
Contributing
- Fork it ( https://bitbucket.org/antonovga/datetime_splitter/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request