summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-11 14:36:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-11 14:36:43 +0000
commit6c5b29bb681ba1f11de2c04e78de1d306bcf7883 (patch)
treea519e1404cb8838cde7c19fac1d1f867a6b182f5 /app
parent308a922d80331d139b576d44728e1c49d5321a7f (diff)
downloadredmine-6c5b29bb681ba1f11de2c04e78de1d306bcf7883.tar.gz
redmine-6c5b29bb681ba1f11de2c04e78de1d306bcf7883.zip
More accurate date validation.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6265 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/query.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index ab0b3320d..4ea344b5a 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -179,7 +179,7 @@ class Query < ActiveRecord::Base
when :date, :date_past
case operator_for(field)
when "=", ">=", "<=", "><"
- errors.add(label_for(field), :invalid) if values_for(field).detect {|v| v.present? && !v.match(/^\d{4}-\d{2}-\d{2}$/) }
+ errors.add(label_for(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-"
errors.add(label_for(field), :invalid) if values_for(field).detect {|v| v.present? && !v.match(/^\d+$/) }
end