diff --git a/app/views/datagrid/_range_filter.html.erb b/app/views/datagrid/_range_filter.html.erb
index b308d43..ffbb0f8 100644
--- a/app/views/datagrid/_range_filter.html.erb
+++ b/app/views/datagrid/_range_filter.html.erb
@@ -1,5 +1,4 @@
<%= form.datagrid_filter_input(filter, class: 'datagrid-range-from', **from_options) %>
<%= I18n.t('datagrid.filters.range.separator') %>
-<%# Generating id only for "from" input to make sure
- # there is no duplicate id in DOM and click on label focuses the first input -%>
-<%= form.datagrid_filter_input(filter, class: 'datagrid-range-to', **to_options, id: nil) %>
+<%# Generating id only for "from" input to make sure -%>
+<%# there is no duplicate id in DOM and click on label focuses the first input -%> <%= form.datagrid_filter_input(filter, class: 'datagrid-range-to', **to_options, id: nil) %>
diff --git a/lib/datagrid/filters/date_filter.rb b/lib/datagrid/filters/date_filter.rb
index c219276..e8398f4 100644
--- a/lib/datagrid/filters/date_filter.rb
+++ b/lib/datagrid/filters/date_filter.rb
@@ -12,7 +12,9 @@ def default_input_options
end
def apply(grid_object, scope, value)
- value = value.begin&.beginning_of_day..value.end&.end_of_day if value.is_a?(Range)
+ if value.is_a?(Range) && driver.timestamp_column?(scope, name)
+ value = value.begin&.beginning_of_day..value.end&.end_of_day
+ end
super
end
@@ -28,11 +30,6 @@ def format(value)
end
end
- def default_filter_where(scope, value)
- value = Datagrid::Utils.format_date_as_timestamp(value) if driver.timestamp_column?(scope, name)
- super
- end
-
protected
def formats