Add time elements for accessibility

This commit is contained in:
Edgar P. Burkhart 2024-01-02 15:28:24 +01:00
parent 87c12f47e9
commit b4c7f88b3d
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 12 additions and 4 deletions

View file

@ -41,7 +41,9 @@
{% if snap.file %}<a href="{{ snap.file.url }}">{{ "attachment"|remix }}</a>{% endif %}
</td>
<th class="date" scope="row">
<a href="{{ snap.get_absolute_url }}">{{ snap.date|date:"Y-m-d" }}</a>
<a href="{{ snap.get_absolute_url }}">
<time datetime="{{ snap.date|date:"Y-m-d" }}">{{ snap.date|date:"Y-m-d" }}</time>
</a>
</th>
{% if not account %}
<td class="r">{{ snap.account.icon|remix }}</td>

View file

@ -43,7 +43,9 @@
<td class="c">
{% for invoice in trans.invoices %}<a href="{{ invoice.file.url }}">{{ "attachment"|remix }}</a>{% endfor %}
</td>
<td class="date">{{ trans.date|date:"Y-m-d" }}</td>
<td class="date">
<time datetime="{{ trans.date|date:"Y-m-d" }}">{{ trans.date|date:"Y-m-d" }}</time>
</td>
<th scope="row" class="l">
<a href="{{ trans.get_absolute_url }}">{{ trans.name }}</a>
</th>

View file

@ -18,7 +18,8 @@ def month_url(context, month, cls="", fmt="Y-m"):
url = reverse(url_name, kwargs=url_params)
return mark_safe(
f"""<a class="{cls}" href="{url}">{date(month, fmt).capitalize()}</a>"""
f"""<a class="{cls}" href="{url}"><time datetime="{date(month, "Y-m")}">"""
f"""{date(month, fmt).capitalize()}</time></a>"""
)
@ -29,4 +30,7 @@ def year_url(context, year, cls=""):
url_name, url_params = ac_url("transaction_year", {"year": year}, context)
url = reverse(url_name, kwargs=url_params)
return mark_safe(f"""<a class="{cls}" href="{url}">{ year }</a>""")
return mark_safe(
f"""<a class="{cls}" href="{url}">"""
f"""<time datetime="{year}">{year}</time></a>"""
)