mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Do not perform any timezone conversions if SOURCE_DATE_EPOCH is set (#13203)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
3967c7d3ac
commit
de4d3171a8
@ -249,6 +249,9 @@ def format_date(
|
||||
source_date_epoch = os.getenv('SOURCE_DATE_EPOCH')
|
||||
if source_date_epoch is not None:
|
||||
date = datetime.fromtimestamp(float(source_date_epoch), tz=UTC)
|
||||
# If SOURCE_DATE_EPOCH is set, users likely want a reproducible result,
|
||||
# so enforce GMT/UTC for consistency.
|
||||
local_time = False
|
||||
else:
|
||||
date = datetime.now(tz=UTC)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user