|
|
|
|
@ -64,47 +64,47 @@ func formatDatetime(tm time.Time) string { |
|
|
|
|
tmSince := time.Since(tm) |
|
|
|
|
hrs := tmSince.Hours() |
|
|
|
|
yrs := int(hrs / (365 * 24)) |
|
|
|
|
if yrs > 1 { |
|
|
|
|
return strconv.Itoa(yrs) + " years ago" |
|
|
|
|
} |
|
|
|
|
if yrs > 0 { |
|
|
|
|
if yrs == 1 { |
|
|
|
|
return "1 year ago" |
|
|
|
|
} |
|
|
|
|
months := int(hrs / (30 * 24)) |
|
|
|
|
if months > 1 { |
|
|
|
|
return strconv.Itoa(months) + " months ago" |
|
|
|
|
return strconv.Itoa(yrs) + " years ago" |
|
|
|
|
} |
|
|
|
|
months := int(hrs / (30 * 24)) |
|
|
|
|
if months > 0 { |
|
|
|
|
if months == 1 { |
|
|
|
|
return "1 month ago" |
|
|
|
|
} |
|
|
|
|
days := int(hrs / 24) |
|
|
|
|
if days > 1 { |
|
|
|
|
return strconv.Itoa(days) + " days ago" |
|
|
|
|
return strconv.Itoa(months) + " months ago" |
|
|
|
|
} |
|
|
|
|
days := int(hrs / 24) |
|
|
|
|
if days > 0 { |
|
|
|
|
if days == 1 { |
|
|
|
|
return "1 day ago" |
|
|
|
|
} |
|
|
|
|
hrsInt := int(hrs) |
|
|
|
|
if hrsInt > 1 { |
|
|
|
|
return strconv.Itoa(hrsInt) + " hours ago" |
|
|
|
|
return strconv.Itoa(days) + " days ago" |
|
|
|
|
} |
|
|
|
|
hrsInt := int(hrs) |
|
|
|
|
if hrsInt > 0 { |
|
|
|
|
if hrsInt == 1 { |
|
|
|
|
return "1 hour ago" |
|
|
|
|
} |
|
|
|
|
mins := int(hrs * 60) |
|
|
|
|
if mins > 1 { |
|
|
|
|
return strconv.Itoa(mins) + " mins ago" |
|
|
|
|
return strconv.Itoa(hrsInt) + " hours ago" |
|
|
|
|
} |
|
|
|
|
mins := int(hrs * 60) |
|
|
|
|
if mins > 0 { |
|
|
|
|
if mins == 1 { |
|
|
|
|
return "1 min ago" |
|
|
|
|
} |
|
|
|
|
secs := int(hrs * 60 * 60) |
|
|
|
|
if secs > 1 { |
|
|
|
|
return strconv.Itoa(secs) + " secs ago" |
|
|
|
|
return strconv.Itoa(mins) + " mins ago" |
|
|
|
|
} |
|
|
|
|
secs := int(hrs * 60 * 60) |
|
|
|
|
if secs > 0 { |
|
|
|
|
if secs == 1 { |
|
|
|
|
return "1 sec ago" |
|
|
|
|
} |
|
|
|
|
return strconv.Itoa(secs) + " secs ago" |
|
|
|
|
} |
|
|
|
|
return "now" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|