From 116d3fba119836fd478376d6cffe2884789fc701 Mon Sep 17 00:00:00 2001 From: Viktor Haag Date: Fri, 28 Jun 2019 14:48:58 -0400 Subject: [PATCH] Force last update datetime value to always be UTC - If SOURCE_DATE_EPOCH is set in the environment, then the build date will use UTC as the timezone. - If it's not set in the environment, we should do the same thing and use UTC as the timezone for the build date. - `datetime.now()` produces a naive system-time datetime object; `datetime.utcnow()` produces the aware, UTC-oriented datetime object. --- sphinx/util/i18n.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/util/i18n.py b/sphinx/util/i18n.py index 8638d4058..1e721da4e 100644 --- a/sphinx/util/i18n.py +++ b/sphinx/util/i18n.py @@ -286,7 +286,7 @@ def format_date(format, date=None, language=None): if source_date_epoch is not None: date = datetime.utcfromtimestamp(float(source_date_epoch)) else: - date = datetime.now() + date = datetime.utcnow() result = [] tokens = date_format_re.split(format)