Skip to content

Commit 763d65b

Browse files
Added current time zone to render method in DateTimeColumn (#16323)
1 parent fbe64cb commit 763d65b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

netbox/netbox/tables/columns.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import zoneinfo
12
from dataclasses import dataclass
23
from typing import Optional
34
from urllib.parse import quote
@@ -83,6 +84,8 @@ def __init__(self, *args, timespec='seconds', **kwargs):
8384

8485
def render(self, value):
8586
if value:
87+
current_tz = zoneinfo.ZoneInfo(settings.TIME_ZONE)
88+
value = value.astimezone(current_tz)
8689
return f"{value.date().isoformat()} {value.time().isoformat(timespec=self.timespec)}"
8790

8891
def value(self, value):

0 commit comments

Comments
 (0)