Skip to content

Commit 21b5a6c

Browse files
Merge pull request #123 from AAA-Intelligence/improvement/fix-bot-age-web-ui
Fix bot age calculation for Web UI
2 parents 71eb03d + d162d5d commit 21b5a6c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

manager/utils.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,10 @@ func formatTime(time *time.Time) string {
5858

5959
// Returns the number of years that have passed since the given date
6060
func yearsSince(date *time.Time) int {
61-
return int(time.Since(*date).Hours() / float64(24*356))
61+
today := time.Now()
62+
years := today.Year() - date.Year()
63+
if today.Month() < date.Month() || today.Month() == date.Month() && today.Day() < date.Day() {
64+
years--
65+
}
66+
return years
6267
}

0 commit comments

Comments
 (0)