Validate value for date filters.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10767 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
cb7ab9bc0c
commit
b9c72bf590
|
@ -183,7 +183,7 @@ class Query < ActiveRecord::Base
|
|||
case operator_for(field)
|
||||
when "=", ">=", "<=", "><"
|
||||
add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && (!v.match(/^\d{4}-\d{2}-\d{2}$/) || (Date.parse(v) rescue nil).nil?) }
|
||||
when ">t-", "<t-", "t-"
|
||||
when ">t-", "<t-", "t-", ">t+", "<t+", "t+"
|
||||
add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !v.match(/^\d+$/) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue