Use "quot" to round negative ages towards zero
I was using "div" which rounds towards negative infinity, so negative age differences of less than a year had -1 rather than 0 in the years field.
This commit is contained in:
parent
c95b99dc3a
commit
41b526d375
|
@ -87,7 +87,7 @@ findAge = do
|
|||
return (\dob ->
|
||||
let monthsAndDays = diffGregorianDurationClip today dob
|
||||
totalMonths = cdMonths monthsAndDays
|
||||
y = div totalMonths 12
|
||||
y = quot totalMonths 12
|
||||
m = rem totalMonths 12
|
||||
d = cdDays monthsAndDays
|
||||
countdown = diffDays (nextbday dob) today
|
||||
|
|
Loading…
Reference in New Issue