feat: add timezone to datetime display across the board

- the "Flagged Out-of-date on ..." link in the package action panel does
  not contain a timezone specifier.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-02-05 18:35:50 -08:00
parent e777b7052e
commit 1545eab81d
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
15 changed files with 47 additions and 41 deletions

View file

@ -17,7 +17,7 @@
username,
comment.ID
),
commented_at.strftime("%Y-%m-%d %H:%M"),
datetime_display(comment.CommentTS),
"</a>"
) | safe
}}
@ -25,7 +25,7 @@
{% set edited_on = comment.EditedTS | dt | as_timezone(timezone) %}
<span class="edited">
({{ "edited on %s by %s" | tr
| format(edited_on.strftime('%Y-%m-%d %H:%M'),
| format(datetime_display(comment.EditedTS),
'<a href="/account/%s">%s</a>' | format(
comment.Editor.Username, comment.Editor.Username))
| safe

View file

@ -34,10 +34,9 @@
<li>
<span class="flagged">
<a href="/pkgbase/{{ pkgbase.Name }}/flag-comment">
{% set ood_ts = pkgbase.OutOfDateTS | dt | as_timezone(timezone) %}
{{
"Flagged out-of-date (%s)"
| tr | format(ood_ts.strftime("%Y-%m-%d"))
| tr | format(date_strftime(package.PackageBase.OutOfDateTS, "%Y-%m-%d"))
}}
</a>
</span>

View file

@ -18,8 +18,8 @@
)) if request.user.is_authenticated() else
(comment.User.Username),
'<a href="#comment-%s" class="date">%s</a>' | format(
comment.ID,
commented_at.strftime("%Y-%m-%d %H:%M")
comment.ID,
datetime_display(comment.CommentTS)
)
)
| safe
@ -28,7 +28,7 @@
{% set edited_on = comment.EditedTS | dt | as_timezone(timezone) %}
<span class="edited">
({{ "edited on %s by %s" | tr
| format(edited_on.strftime('%Y-%m-%d %H:%M'),
| format(datetime_display(comment.EditedTS),
'<a href="/account/%s">%s</a>' | format(
comment.Editor.Username, comment.Editor.Username))
| safe

View file

@ -150,14 +150,12 @@
<td>{{ pkgbase.Popularity | number_format(6 if pkgbase.Popularity <= 0.2 else 2) }}</td>
</tr>
<tr>
{% set submitted = pkgbase.SubmittedTS | dt | as_timezone(timezone) %}
<th>{{ "First Submitted" | tr }}:</th>
<td>{{ "%s" | format(submitted.strftime("%Y-%m-%d %H:%M")) }}</td>
<td>{{ datetime_display(pkgbase.SubmittedTS) }}</td>
</tr>
<tr>
<th>{{ "Last Updated" | tr }}:</th>
{% set updated = pkgbase.ModifiedTS | dt | as_timezone(timezone) %}
<td>{{ "%s" | format(updated.strftime("%Y-%m-%d %H:%M")) }}</td>
<td>{{ datetime_display(pkgbase.ModifiedTS) }}</td>
</tr>
</table>

View file

@ -40,7 +40,7 @@
{{ request.User.Username }}
</a>
</td>
<td>{{ requested.strftime("%Y-%m-%d %H:%M") }}</td>
<td>{{ datetime_display(request.RequestTS) }}</td>
<td>{{ request.status_display() | tr }}</td>
</tr>
{% endfor %}

View file

@ -24,8 +24,7 @@
</a>
</td>
<td class="pkg-date">
{% set modified = pkg.PackageBase.ModifiedTS | dt | as_timezone(timezone) %}
{{ modified.strftime("%Y-%m-%d %H:%M") }}
{{ datetime_display(pkg.PackageBase.ModifiedTS) }}
</td>
</tr>
{% endfor %}

View file

@ -21,15 +21,13 @@
</strong>
</div>
{% set submitted = voteinfo.Submitted | dt | as_timezone(timezone) %}
{% set submitter = voteinfo.Submitter.Username %}
{% set submitter_uri = "/account/%s" | format(submitter) %}
{% set submitter = '<a href="%s">%s</a>' | format(submitter_uri, submitter) %}
{% set end = voteinfo.End | dt | as_timezone(timezone) %}
<div class="field submitted">
{{
"Submitted: %s by %s" | tr
| format(submitted.strftime("%Y-%m-%d %H:%M"), submitter)
| format(datetime_display(voteinfo.Submitted), submitter)
| safe
}}
</div>
@ -37,7 +35,7 @@
<div class="field end">
{{ "End" | tr }}:
<strong>
{{ end.strftime("%Y-%m-%d %H:%M") }}
{{ datetime_display(voteinfo.End) }}
</strong>
</div>

View file

@ -47,15 +47,8 @@
<a href="/tu/{{ result.ID }}">{{ agenda }}</a>
</td>
<!-- Convert result.Submitted (timestamp) to datetime,
then apply the request's timezone to it. -->
{% set submitted = result.Submitted | dt | as_timezone(timezone) %}
<td>{{ submitted.strftime("%Y-%m-%d") }}</td>
<!-- Convert result.End (timestamp) to datetime,
then apply the request's timezone to it. -->
{% set end = result.End | dt | as_timezone(timezone) %}
<td>{{ end.strftime("%Y-%m-%d") }}</td>
<td>{{ date_display(result.Submitted) }}</td>
<td>{{ date_display(result.End) }}</td>
<td>
{% if not result.User %}