Skip to content

Commit 084df8a

Browse files
committed
Include seconds in input_value
This preserves existing values with seconds in them instead of overwriting the seconds with 0. This is helpful if using the overrides from the [README](https://github.com/activeadmin-plugins/active_admin_datetimepicker#override-behaviour-in-initializer)
1 parent 5d36e93 commit 084df8a

File tree

1 file changed

+1
-1
lines changed
  • lib/active_admin_datetimepicker

1 file changed

+1
-1
lines changed

lib/active_admin_datetimepicker/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def input_html_options(input_name = nil)
2828

2929
def input_value(input_name = nil)
3030
val = object.public_send(input_name || method)
31-
return DateTime.new(val.year, val.month, val.day, val.hour, val.min).strftime(format) if val.is_a?(Time)
31+
return DateTime.new(val.year, val.month, val.day, val.hour, val.min, val.sec).strftime(format) if val.is_a?(Time)
3232
val.to_s
3333
end
3434

0 commit comments

Comments
 (0)