From bbcd6e01baff5a08541522a92b18e8315081bcd2 Mon Sep 17 00:00:00 2001 From: vaot Date: Fri, 5 Aug 2022 15:10:19 -0700 Subject: [PATCH] Add option to set date picket input format at the input level --- app/inputs/date_time_picker_input.rb | 2 +- docs/date-time-picker.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/inputs/date_time_picker_input.rb b/app/inputs/date_time_picker_input.rb index 5af508c9..be6a4158 100644 --- a/app/inputs/date_time_picker_input.rb +++ b/app/inputs/date_time_picker_input.rb @@ -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 diff --git a/docs/date-time-picker.md b/docs/date-time-picker.md index b453dcf9..43691a01 100644 --- a/docs/date-time-picker.md +++ b/docs/date-time-picker.md @@ -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: