Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set date picker input format at the input level #417

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/inputs/date_time_picker_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def formatted_input_value

if v.is_a?(Time)
return DateTime.new(v.year, v.month, v.day, v.hour, v.min, v.sec).strftime(
ActiveadminAddons.datetime_picker_input_format
options[:input_format] || ActiveadminAddons.datetime_picker_input_format
)
end

Expand Down
2 changes: 2 additions & 0 deletions docs/date-time-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ form do |f|
f.actions
```

You can also pass `input_format` to set DateTimePickerInput input format that should be expected from the backend. This option also be set globally in the options below.

## Overriding defaults

You can modify, in the gem's setup block, the default options like this:
Expand Down