mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
UTC completed
This commit is contained in:
parent
e32c893aa1
commit
7a6ffbf0b4
1 changed files with 8 additions and 0 deletions
|
|
@ -9,10 +9,13 @@ import functools
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
import pytz
|
||||
import pdb
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
|
||||
from pelican import signals
|
||||
from pelican.settings import DEFAULT_CONFIG
|
||||
from pelican.utils import (slugify, truncate_html_words, memoized, strftime,
|
||||
|
|
@ -108,6 +111,11 @@ class Content(object):
|
|||
|
||||
if hasattr(self, 'date'):
|
||||
self.locale_date = strftime(self.date, self.date_format)
|
||||
#Set UTC timezone
|
||||
if self.date.tzinfo is not None:
|
||||
local_tz = pytz.timezone(settings['TIMEZONE'])
|
||||
self.date = self.date.replace(tzinfo=local_tz)
|
||||
self.utcdate = datetime.astimezone(self.date, pytz.timezone("UTC"))
|
||||
|
||||
# manage status
|
||||
if not hasattr(self, 'status'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue