mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-10 01:28:16 -06:00
Added current time zone to render method in DateTimeColumn
This commit is contained in:
parent
103c08c2d2
commit
911ff4da9e
@ -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