README.md in datetime_picker_input-4.17.37 vs README.md in datetime_picker_input-4.17.37.1
- old
+ new
@@ -1,8 +1,8 @@
# DatetimePickerInput
-[](https://travis-ci.org/jollygoodcode/datetime_picker_input)
+[](https://badge.fury.io/rb/datetime_picker_input) [](https://travis-ci.org/jollygoodcode/datetime_picker_input)
DatetimePickerInput allows you to easily add a [JavaScript datetime picker](http://eonasdan.github.io/bootstrap-datetimepicker/) to your Ruby on Rails, Bootstrap-enabled Simple Form input.
## Prerequisites
@@ -61,26 +61,26 @@
However, if you do change the format (like in the Customized Options example),
then you will need to implement your attribute setter and getter in Rails backend
to save and display the value correctly in your desired Time Zone.
One way to do this is to implement an `around_filter` on your controllers like so:
-
+
```ruby
class AppointmentsController < ApplicationController
around_action :use_current_timezone
-
+
# .. your controller code
-
+
def use_current_timezone(&block)
Time.use_zone(current_user.timezone, &block)
end
-end
+end
```
This uses your `user`'s Time Zone, so that the DateTime gets stored and will be displayed as expected (from the user's perspective).
-We are also assuming that, in this example, the `current_user` has set a custom Time Zone,
-otherwise, you should just use the gem's default.
+We are also assuming that, in this example, the `current_user` has set a custom Time Zone,
+otherwise, you should just use the gem's default.
Times are hard..
### Customized Options