Fixe time being dropped from blog post dates

This commit is contained in:
squidfunk 2023-12-07 21:46:36 +01:00
parent 63de1a0567
commit 5b70a0cfcb
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
2 changed files with 16 additions and 0 deletions

View File

@ -62,6 +62,14 @@ class PostDate(BaseConfigOption[DateDict]):
# Convert all date values to datetime
for key, value in config[key_name].items():
# Handle datetime - since datetime is a subclass of date, we need
# to check it first, or we'll loose time - see https://t.ly/-KG9N
if isinstance(value, datetime):
continue
# Handle date - we set 00:00:00 as the default time, if the author
# only supplied a date, and convert it to datetime
if isinstance(value, date):
config[key_name][key] = datetime.combine(value, time())

View File

@ -62,6 +62,14 @@ class PostDate(BaseConfigOption[DateDict]):
# Convert all date values to datetime
for key, value in config[key_name].items():
# Handle datetime - since datetime is a subclass of date, we need
# to check it first, or we'll loose time - see https://t.ly/-KG9N
if isinstance(value, datetime):
continue
# Handle date - we set 00:00:00 as the default time, if the author
# only supplied a date, and convert it to datetime
if isinstance(value, date):
config[key_name][key] = datetime.combine(value, time())