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:
Jean-Philippe Lang 2012-10-30 07:53:14 +00:00
parent cb7ab9bc0c
commit b9c72bf590
1 changed files with 1 additions and 1 deletions

View File

@ -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