mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Added current time zone to render method in DateTimeColumn (#16323)
This commit is contained in:
parent
fbe64cb9a4
commit
763d65bed9
@ -1,3 +1,4 @@
|
|||||||
|
import zoneinfo
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
@ -83,6 +84,8 @@ class DateTimeColumn(tables.Column):
|
|||||||
|
|
||||||
def render(self, value):
|
def render(self, value):
|
||||||
if value:
|
if value:
|
||||||
|
current_tz = zoneinfo.ZoneInfo(settings.TIME_ZONE)
|
||||||
|
value = value.astimezone(current_tz)
|
||||||
return f"{value.date().isoformat()} {value.time().isoformat(timespec=self.timespec)}"
|
return f"{value.date().isoformat()} {value.time().isoformat(timespec=self.timespec)}"
|
||||||
|
|
||||||
def value(self, value):
|
def value(self, value):
|
||||||
|
Loading…
Reference in New Issue
Block a user