Skip to content

Commit 89ee521

Browse files
committed
check for valid date before constructing query
1 parent dffa889 commit 89ee521

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/ajax-datatables-rails/base.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ def filter_relation(relation)
1616
qry = []
1717
filter.each do | k, v |
1818
if k.end_with?("_at") and v.size == 2
19-
qry << "( #{k} >= '#{v[0].to_time.beginning_of_day}' AND #{k} <= '#{v[1].to_time.end_of_day}' )"
19+
start_at = v[0].to_time
20+
end_at = v[1].to_time
21+
qry << "( #{k} >= '#{start_at.beginning_of_day}' AND #{k} <= '#{end_at.end_of_day}' )" if start_at.present? and end_at.present?
2022
else
2123
qry << "(" + v.map{|n|
2224

0 commit comments

Comments
 (0)