summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-11 13:22:57 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-11 13:22:57 +0000
commit981a6223e40ef7d1550f155202279dee5b7f8978 (patch)
tree8087d8f49b13b3b62914751a88442ddf1d7ea30e /app
parent55b2ca81707b49b1f839f44b77d88e6d145fe5dc (diff)
downloadredmine-981a6223e40ef7d1550f155202279dee5b7f8978.tar.gz
redmine-981a6223e40ef7d1550f155202279dee5b7f8978.zip
Custom date field accepts invalid dates (#9394).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7779 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/custom_value.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/custom_value.rb b/app/models/custom_value.rb
index 6d4af178a..dae8f73ef 100644
--- a/app/models/custom_value.rb
+++ b/app/models/custom_value.rb
@@ -64,7 +64,7 @@ protected
when 'float'
begin; Kernel.Float(value); rescue; errors.add(:value, :invalid) end
when 'date'
- errors.add(:value, :not_a_date) unless value =~ /^\d{4}-\d{2}-\d{2}$/
+ errors.add(:value, :not_a_date) unless value =~ /^\d{4}-\d{2}-\d{2}$/ && begin; value.to_date; rescue; false end
when 'list'
errors.add(:value, :inclusion) unless custom_field.possible_values.include?(value)
end