diff options
| author | Eltrac <hi@guhub.cn> | 2025-11-26 16:46:15 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-11-26 16:46:15 +0800 |
| commit | 3fef33e7be229620118b4cc967126f804e59a5cd (patch) | |
| tree | 157f1442a20b094a8d239fe43c977039917b0481 /layouts/_shortcodes/daysfrom.html | |
| parent | bcfeb5371c9d6462806ffef4947b6af6798e91d5 (diff) | |
feat: site uptime count in sponsor page
Diffstat (limited to 'layouts/_shortcodes/daysfrom.html')
| -rw-r--r-- | layouts/_shortcodes/daysfrom.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/layouts/_shortcodes/daysfrom.html b/layouts/_shortcodes/daysfrom.html new file mode 100644 index 00000000..c2750480 --- /dev/null +++ b/layouts/_shortcodes/daysfrom.html @@ -0,0 +1,12 @@ +{{- $date := .Get 0 -}} +{{- $t := time $date -}} +{{- $now := now -}} +{{- $durSeconds := sub $now.Unix $t.Unix | int -}} + +{{- $days := div $durSeconds 86400 -}} + +{{- if lt $days 0 -}} + {{ mul $days -1 }} +{{- else -}} + {{ $days }} +{{- end -}} |
