mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-23 23:21:00 +01:00
Fixed blog plugin crashing on missing timezone (regression) (#7730)
* Default timezone to UTC for blog plugin created date Fix for https://github.com/squidfunk/mkdocs-material/issues/7725 * Fix variable name * Run build
This commit is contained in:
parent
0947f73db3
commit
eee4934efd
@ -66,7 +66,11 @@ class PostDate(BaseConfigOption[DateDict]):
|
||||
# Handle datetime - since datetime is a subclass of date, we need
|
||||
# to check it first, or we lose the time - see https://t.ly/-KG9N
|
||||
if isinstance(value, datetime):
|
||||
continue
|
||||
# Set timezone to UTC if not set
|
||||
if value.tzinfo is None:
|
||||
config[key_name][key] = value.replace(tzinfo=timezone.utc)
|
||||
continue;
|
||||
|
||||
|
||||
# Handle date - we set 00:00:00 as the default time, if the author
|
||||
# only supplied a date, and convert it to datetime in UTC
|
||||
|
@ -66,7 +66,11 @@ class PostDate(BaseConfigOption[DateDict]):
|
||||
# Handle datetime - since datetime is a subclass of date, we need
|
||||
# to check it first, or we lose the time - see https://t.ly/-KG9N
|
||||
if isinstance(value, datetime):
|
||||
continue
|
||||
# Set timezone to UTC if not set
|
||||
if value.tzinfo is None:
|
||||
config[key_name][key] = value.replace(tzinfo=timezone.utc)
|
||||
continue;
|
||||
|
||||
|
||||
# Handle date - we set 00:00:00 as the default time, if the author
|
||||
# only supplied a date, and convert it to datetime in UTC
|
||||
|
Loading…
Reference in New Issue
Block a user