iommirocks / iommi

Your first pick for a django power cord
http://iommi.rocks
BSD 3-Clause "New" or "Revised" License
688 stars 47 forks source link

datetime rendered always in UTC - Form and Table #463

Closed berycz closed 11 months ago

berycz commented 11 months ago

table.py

def datetime_formatter(value, **_):
    return date_format(value, format='DATETIME_FORMAT')

should be

from django.utils import timezone

def datetime_formatter(value, **_):
    return date_format(timezone.localtime(value), format='DATETIME_FORMAT')

and form.py

def datetime_render_value(value, **_):
    return value.strftime(datetime_iso_formats[0]) if value else ''

should be

from django.utils import timezone

def datetime_render_value(value, **_):
    return timezone.localtime(value).strftime(datetime_iso_formats[0]) if value else ''