feat: initial commit

This commit is contained in:
redtea committed 2026-10-13 00:25:29 +03:00
1 parent 353f62e257
commit c6852c6f1b
62 files changed
+5911 -2

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package server
import (
"fmt"
"time"
)
// humanSince renders a coarse "time ago" label for the dashboard.
func humanSince(t time.Time) string {
if t.IsZero() {
return "никогда"
}
d := time.Since(t)
switch {
case d < 10*time.Second:
return "только что"
case d < time.Minute:
return fmt.Sprintf("%d сек назад", int(d.Seconds()))
case d < time.Hour:
return fmt.Sprintf("%d мин назад", int(d.Minutes()))
case d < 24*time.Hour:
return fmt.Sprintf("%d ч назад", int(d.Hours()))
default:
return fmt.Sprintf("%d дн назад", int(d.Hours()/24))
}
}