diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-notification.html b/src/fellchensammlung/templates/fellchensammlung/partials/partial-notification.html
index 8b94754..1179a5d 100644
--- a/src/fellchensammlung/templates/fellchensammlung/partials/partial-notification.html
+++ b/src/fellchensammlung/templates/fellchensammlung/partials/partial-notification.html
@@ -9,7 +9,7 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
diff --git a/src/fellchensammlung/templatetags/custom_tags.py b/src/fellchensammlung/templatetags/custom_tags.py
index 0608ef0..cb90d33 100644
--- a/src/fellchensammlung/templatetags/custom_tags.py
+++ b/src/fellchensammlung/templatetags/custom_tags.py
@@ -4,7 +4,9 @@ from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from urllib.parse import urlparse
+from django.utils import timezone
+from fellchensammlung.tools.misc import time_since_as_hr_string
from notfellchen import settings
from fellchensammlung.models import TrustLevel
@@ -114,3 +116,9 @@ def dictkey(d, key):
def host():
# Will not work for localhost or deployments without https
return f"https://{settings.host}"
+
+
+@register.filter
+def time_since_hr(timestamp):
+ t_delta = timezone.now() - timestamp
+ return time_since_as_hr_string(t_delta)
diff --git a/src/fellchensammlung/tools/misc.py b/src/fellchensammlung/tools/misc.py
index bfc8b79..5403dfe 100644
--- a/src/fellchensammlung/tools/misc.py
+++ b/src/fellchensammlung/tools/misc.py
@@ -37,6 +37,8 @@ def time_since_as_hr_string(age: datetime.timedelta) -> str:
weeks = age.days / 7
months = age.days / 30
years = age.days / 365
+ minutes = age.seconds / 60
+ hours = age.seconds / 3600
if years >= 1:
text = ngettext(
"vor einem Jahr",
@@ -49,11 +51,14 @@ def time_since_as_hr_string(age: datetime.timedelta) -> str:
text = _("vor %(month)d Monaten") % {"month": months}
elif weeks >= 3:
text = _("vor %(weeks)d Wochen") % {"weeks": weeks}
+ elif days >= 1:
+ text = ngettext("vor einem Tag","vor %(count)d Tagen", days,) % {"count": days,}
+ elif hours >= 1:
+ text = ngettext("vor einer Stunde", "vor %(count)d Stunden", hours,) % {"count": hours,}
+ elif minutes >= 1:
+ text = ngettext("vor einer Minute", "vor %(count)d Minuten", minutes, ) % {"count": minutes, }
else:
- if days == 0:
- text = _("Heute")
- else:
- text = ngettext("vor einem Tag","vor %(count)d Tagen", days,) % {"count": days,}
+ text = _("Gerade eben")
return text