You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(alerts): respect 24-hour clock preference in email notifications (#106884)
emails now check if you're a 24-hour time person and format accordingly.
issue alerts, digests, and feedback emails all got the change.
Fixes#106581
the html is kinda miserable to review but it works
<img width="586" height="113" alt="24tz"
src="https://github.com/user-attachments/assets/a5d44869-aabb-42c6-a13f-bf9639b38d9b"
/>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/sentry/templates/sentry/emails/digests/body.html
+26-12Lines changed: 26 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -24,14 +24,26 @@
24
24
25
25
<divclass="container" style="padding-top: 30px;">
26
26
<h2>{{ counts|length }} new alert{{ counts|pluralize }} from <ahref="{{ project.get_absolute_url }}">{{ project.slug }}</a></h2>
27
-
{% if timezone %}
28
-
{% with start=start|timezone:timezone|date:"N j, Y, P e" end=end|timezone:timezone|date:"N j, Y, P e" %}
29
-
<divclass="dateline">{{ start }}{% if start != end %} to {{ end }}{% endif %}</div>
30
-
{% endwith %}
27
+
{% if clock_24_hours %}
28
+
{% if timezone %}
29
+
{% with start=start|timezone:timezone|date:"N j, Y, H:i e" end=end|timezone:timezone|date:"N j, Y, H:i e" %}
30
+
<divclass="dateline">{{ start }}{% if start != end %} to {{ end }}{% endif %}</div>
31
+
{% endwith %}
32
+
{% else %}
33
+
{% with start=start|date:"N j, Y, H:i e" end=end|date:"N j, Y, H:i e" %}
34
+
<divclass="dateline">{{ start }}{% if start != end %} to {{ end }}{% endif %}</div>
35
+
{% endwith %}
36
+
{% endif %}
31
37
{% else %}
32
-
{% with start=start|date:"N j, Y, P e" end=end|date:"N j, Y, P e" %}
33
-
<divclass="dateline">{{ start }}{% if start != end %} to {{ end }}{% endif %}</div>
34
-
{% endwith %}
38
+
{% if timezone %}
39
+
{% with start=start|timezone:timezone|date:"N j, Y, P e" end=end|timezone:timezone|date:"N j, Y, P e" %}
40
+
<divclass="dateline">{{ start }}{% if start != end %} to {{ end }}{% endif %}</div>
41
+
{% endwith %}
42
+
{% else %}
43
+
{% with start=start|date:"N j, Y, P e" end=end|date:"N j, Y, P e" %}
44
+
<divclass="dateline">{{ start }}{% if start != end %} to {{ end }}{% endif %}</div>
45
+
{% endwith %}
46
+
{% endif %}
35
47
{% endif %}
36
48
</div>
37
49
@@ -62,11 +74,13 @@ <h2>{{ counts|length }} new alert{{ counts|pluralize }} from <a href="{{ project
62
74
<tdclass="event-detail">
63
75
{% include "sentry/emails/_group.html" %}
64
76
<div>
65
-
{% if timezone %}
66
-
<small>{{ records.0.datetime|timezone:timezone|date:"N j, Y, g:i:s a e" }}</small>
67
-
{% else %}
68
-
<small>{{ records.0.datetime|date:"N j, Y, g:i:s a e" }}</small>
69
-
{% endif %}
77
+
<small>
78
+
{% if clock_24_hours %}
79
+
{% if timezone %}{{ records.0.datetime|timezone:timezone|date:"N j, Y, H:i:s e" }}{% else %}{{ records.0.datetime|date:"N j, Y, H:i:s e" }}{% endif %}
80
+
{% else %}
81
+
{% if timezone %}{{ records.0.datetime|timezone:timezone|date:"N j, Y, g:i:s a e" }}{% else %}{{ records.0.datetime|date:"N j, Y, g:i:s a e" }}{% endif %}
Copy file name to clipboardExpand all lines: src/sentry/templates/sentry/emails/digests/body.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
{% load timezone from tz %}
2
2
{% load sentry_helpers %}
3
3
{% load sentry_features %}Notifications for {{ project.slug }}
4
-
{% if timezone %}{{ start|timezone:timezone|date:"N j, Y, P e" }} to {{ end|timezone:timezone|date:"N j, Y, P e" }}{% else %}{{ start|date:"N j, Y, P e" }} to {{ end|date:"N j, Y, P e" }}{% endif %}
4
+
{% if clock_24_hours %}{% if timezone %}{{ start|timezone:timezone|date:"N j, Y, H:i e" }} to {{ end|timezone:timezone|date:"N j, Y, H:i e" }}{% else %}{{ start|date:"N j, Y, H:i e" }} to {{ end|date:"N j, Y, H:i e" }}{% endif %}{% else %}{% if timezone %}{{ start|timezone:timezone|date:"N j, Y, P e" }} to {{ end|timezone:timezone|date:"N j, Y, P e" }}{% else %}{{ start|date:"N j, Y, P e" }} to {{ end|date:"N j, Y, P e" }}{% endif %}{% endif %}
5
5
6
6
{% for rule, groups in digest.items %}{{ rule.label }}
7
7
{% for group, records in groups.items %}{% with event_count=event_counts|get_item:group.id user_count=user_counts|get_item:group.id %}
0 commit comments