Skip to content

Commit e95750d

Browse files
committed
admin: show dates in list display in local time.
1 parent 9bff031 commit e95750d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/dreng/admin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def priority(job: Job) -> str:
2929

3030

3131
def _format_datetime(dt: datetime) -> str:
32-
return dt.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3]
32+
# Make sure we're using local time:
33+
timezone_aware = timezone.localtime(dt)
34+
# Remove tzinfo to avoid UTC offset in output:
35+
timezone_naive = timezone.make_naive(timezone_aware)
36+
return timezone_naive.isoformat(sep=" ", timespec="milliseconds")
3337

3438

3539
@admin.display(ordering="execute_at")

0 commit comments

Comments
 (0)