adroit-age 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/adroit-age.rb +2 -0
- metadata +1 -1
data/lib/adroit-age.rb
CHANGED
@@ -5,5 +5,7 @@ class AdroitAge
|
|
5
5
|
dob = dob.to_date
|
6
6
|
now = Time.now.utc.to_date
|
7
7
|
age = now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
|
8
|
+
raise RuntimeError, 'adroit-age ~> invalid date - Please check the date' if age < 0
|
9
|
+
age
|
8
10
|
end
|
9
11
|
end
|