Birthdate display bugfix

This commit is contained in:
Noah Petherbridge 2023-10-08 15:14:09 -07:00
parent 189ffbb61a
commit de5059c51c
2 changed files with 6 additions and 6 deletions

View File

@ -19,7 +19,7 @@ func AgeAt(dob, now time.Time) int {
age-- age--
} else if now.Month() == dob.Month() { } else if now.Month() == dob.Month() {
// In their birth month, has their day come? // In their birth month, has their day come?
if dob.Day() < now.Day() { if now.Day() < dob.Day() {
age-- age--
} }
} }

View File

@ -28,7 +28,7 @@ func TestAge(t *testing.T) {
}, },
{ {
In: "1996-06-17", In: "1996-06-17",
Expect: 26, Expect: 25,
}, },
{ {
In: "1996-06-15", In: "1996-06-15",
@ -36,7 +36,7 @@ func TestAge(t *testing.T) {
}, },
{ {
In: "1996-06-14", In: "1996-06-14",
Expect: 25, Expect: 26,
}, },
{ {
In: "2000-01-01", In: "2000-01-01",
@ -48,11 +48,11 @@ func TestAge(t *testing.T) {
}, },
{ {
In: "2000-06-12", In: "2000-06-12",
Expect: 21, Expect: 22,
}, },
{ {
In: "2000-06-14", In: "2000-06-14",
Expect: 21, Expect: 22,
}, },
{ {
In: "2000-06-15", In: "2000-06-15",
@ -60,7 +60,7 @@ func TestAge(t *testing.T) {
}, },
{ {
In: "2000-06-16", In: "2000-06-16",
Expect: 22, Expect: 21,
}, },
} }