diff --git a/pelican/contents.py b/pelican/contents.py index 297a537b..7a9a8bc0 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -16,7 +16,7 @@ from pelican import signals from pelican.settings import DEFAULT_CONFIG from pelican.utils import (slugify, truncate_html_words, memoized, strftime, python_2_unicode_compatible, deprecated_attribute, - path_to_url, SafeDatetime) + path_to_url, set_date_tzinfo, SafeDatetime) # Import these so that they're avalaible when you import from pelican.contents. from pelican.urlwrappers import (URLWrapper, Author, Category, Tag) # NOQA @@ -117,9 +117,16 @@ class Content(object): locale.setlocale(locale.LC_ALL, locale_string) self.date_format = self.date_format[1] + # manage timezone + default_timezone = settings.get('TIMEZONE', 'UTC') + timezone = getattr(self, 'timezone', default_timezone) + if hasattr(self, 'date'): + self.date = set_date_tzinfo(self.date, timezone) self.locale_date = strftime(self.date, self.date_format) + if hasattr(self, 'modified'): + self.modified = set_date_tzinfo(self.modified, timezone) self.locale_modified = strftime(self.modified, self.date_format) # manage status diff --git a/pelican/tests/output/basic/a-markdown-powered-article.html b/pelican/tests/output/basic/a-markdown-powered-article.html index 40c96766..5fcc42a9 100644 --- a/pelican/tests/output/basic/a-markdown-powered-article.html +++ b/pelican/tests/output/basic/a-markdown-powered-article.html @@ -34,7 +34,7 @@