diff --git a/CHANGES.txt b/CHANGES.txt index 047f823ac0..ed10388def 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,7 @@ New in v8.1.2 Features -------- +* Fix time zone guessing logic in ``nikola init`` (Issue #3510) * Support for multiple authors per post — comma-separated, enabled by ``MULTIPLE_AUTHORS_PER_POST`` setting (Issue #3252) * Add ``navbar_custom_bg`` theme option to ``bootstrap4`` and document diff --git a/nikola/packages/tzlocal/unix.py b/nikola/packages/tzlocal/unix.py index 086ab7c974..ce3e852c5a 100644 --- a/nikola/packages/tzlocal/unix.py +++ b/nikola/packages/tzlocal/unix.py @@ -116,8 +116,9 @@ def _get_localzone(_root="/"): while start != 0: tzpath = tzpath[start:] try: - dateutil.tz.gettz(tzpath) - return tzpath + tested_tz = dateutil.tz.gettz(tzpath) + if tested_tz: + return tzpath except Exception: pass start = tzpath.find("/") + 1