yksa-web-kit/yksa_web/templates/yksa/ui/_utc.html
2026-08-17 22:42:04 +08:00

16 lines
1,011 B
HTML

{% load tz %}{% comment %}
UTC-primary time: `2026-07-24 11:59:23Z` with the session's zone as a muted
secondary. Never render bare local time on an epoch, an AOS or a reception
timestamp -- a reader who does not know which zone they are looking at cannot
compare two numbers.
{% include "yksa/ui/_utc.html" with dt=element.epoch %}
{% include "yksa/ui/_utc.html" with dt=pass_obj.los date=False %}
dt the datetime (required)
date include the date part (default: yes)
seconds include seconds (default: yes)
local show the muted local secondary (default: yes)
{% endcomment %}{% spaceless %}
<span class="yksa-utc">{% localtime off %}{% if date|default_if_none:True %}{{ dt|utc|date:"Y-m-d " }}{% endif %}{{ dt|utc|date:"H:i" }}{% if seconds|default_if_none:True %}{{ dt|utc|date:":s" }}{% endif %}Z{% endlocaltime %}{% if local|default_if_none:True %} <span class="yksa-local">{% localtime on %}{{ dt|date:"H:i O" }}{% endlocaltime %}</span>{% endif %}</span>
{% endspaceless %}