Permalink
Browse files

fix problem with invalid dates

  • Loading branch information...
1 parent b6a659c commit dddc784354c7742c716e5abf63f46803e7dd0ab3 @grobie committed Oct 8, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 cleaner.rb
View
@@ -105,6 +105,10 @@ def geburtsdatum
year = "19#{$3}".to_i
end
+ unless day && month && year
+ return nil
+ end
+
if month > 12
day, month = month, day
end
@@ -114,7 +118,7 @@ def geburtsdatum
begin
date = Date.parse("#{year}-#{month}-#{day}")
rescue ArgumentError
- if tries < 1
+ if tries < 1
tries += 1
# correct days
if day > 31 || (month == 2 && day > 28) || (month % 2 == 0 && day > 30)

0 comments on commit dddc784

Please sign in to comment.