Birthdate display bugfix
This commit is contained in:
parent
189ffbb61a
commit
de5059c51c
|
@ -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--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user