Skip to content

Conversation

workgena
Copy link
Contributor

@workgena workgena commented Jun 3, 2015

Fix bug when DateTimeRangeInput does not has datepicker_options. In same way as single-DateTimePickerInput.

@Fivell
Copy link
Member

Fivell commented Jun 4, 2015

@workgena , can you pls make it more DRY?

@workgena
Copy link
Contributor Author

workgena commented Jun 4, 2015

@Fivell, check new version

@Fivell
Copy link
Member

Fivell commented Jun 4, 2015

@workgena , please squash you commits in single one

@workgena
Copy link
Contributor Author

With this PR now it is possible to override options. For example if you need date-time with seconds, all you need is to add file

/config/initializer/active_admin_datetimepicker.rb
# This if for fornt-end javascript side
ActiveAdminDatetimepicker::Base.default_datetime_picker_options = {
    format: 'Y-m-d H:i:s',
    defaultDate: proc { DateTime.now.utc.strftime('%y-%m-%d') }
}
# This if for backend(Ruby)
ActiveAdminDatetimepicker::Base.format = "%Y-%m-%d %H:%M:%S"

"default_datetime_picker_options" is XDSoft's DateTime picker options. So you can pass any other options same way.
Full options list: http://xdsoft.net/jqplugins/datetimepicker/

I recomend add this to README.

@Fivell
Copy link
Member

Fivell commented Jun 11, 2015

👍

Fivell added a commit that referenced this pull request Jun 11, 2015
Add data datepicker_options for DateTimeRangeInput, default time form…
@Fivell Fivell merged commit ee2ca5f into activeadmin-plugins:master Jun 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants