File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55# ##################################
66
77# standard
8- from datetime import datetime
98from typing import Union
109
1110# 3rd party
@@ -25,7 +24,7 @@ class _DateFromMeta(Config):
2524 as_creation = config_options .Type (Union [bool , str ], default = "git" )
2625 as_update = config_options .Type (Union [bool , str ], default = "git" )
2726 datetime_format = config_options .Type (str , default = "%Y-%m-%d %H:%M" )
28- default_time = config_options .Type (str , default = datetime . min . strftime ( "%H:%M" ) )
27+ default_time = config_options .Type (str , default = "00:00" )
2928 default_timezone = config_options .Type (str , default = "UTC" )
3029
3130
Original file line number Diff line number Diff line change 1616from jinja2 import Environment , FileSystemLoader , select_autoescape
1717from mkdocs .config import config_options
1818from mkdocs .config .defaults import MkDocsConfig
19- from mkdocs .exceptions import PluginError
2019from mkdocs .plugins import BasePlugin , event_priority , get_plugin_logger
2120from mkdocs .structure .files import Files
2221from mkdocs .structure .pages import Page
@@ -169,12 +168,13 @@ def on_config(self, config: MkDocsConfig) -> MkDocsConfig:
169168 self .config .date_from_meta .default_time = datetime .strptime (
170169 self .config .date_from_meta .default_time , "%H:%M"
171170 )
172- except ValueError as err :
173- raise PluginError (
171+ except ( TypeError , ValueError ) as err :
172+ logger . warning (
174173 "Config error: `date_from_meta.default_time` value "
175174 f"'{ self .config .date_from_meta .default_time } ' format doesn't match the "
176- f"expected format %H:%M. Trace: { err } "
175+ f"expected format %H:%M. Fallback to the default value. Trace: { err } "
177176 )
177+ self .config .date_from_meta .default_time = "00:00"
178178
179179 if self .config .use_git :
180180 logger .debug (
You can’t perform that action at this time.
0 commit comments