mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add timezone to datetime objects. Refs #962.
Based on https://github.com/getpelican/pelican/pull/977, but it adds timezone information before formatting. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
This commit is contained in:
parent
8d14872700
commit
2c50ccb764
92 changed files with 259 additions and 247 deletions
|
|
@ -538,7 +538,9 @@ def set_date_tzinfo(d, tz_name=None):
|
|||
"""Set the timezone for dates that don't have tzinfo"""
|
||||
if tz_name and not d.tzinfo:
|
||||
tz = pytz.timezone(tz_name)
|
||||
return tz.localize(d)
|
||||
d = tz.localize(d)
|
||||
return SafeDatetime(d.year, d.month, d.day, d.hour, d.minute, d.second,
|
||||
d.microsecond, d.tzinfo)
|
||||
return d
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue