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.
This commit is contained in:
Viktor Haag
2019-06-28 14:48:58 -04:00
parent f443fb5579
commit 116d3fba11

View File

@@ -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)