File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 5
5
# ##################################
6
6
7
7
# standard
8
- from datetime import datetime
9
8
from typing import Union
10
9
11
10
# 3rd party
@@ -25,7 +24,7 @@ class _DateFromMeta(Config):
25
24
as_creation = config_options .Type (Union [bool , str ], default = "git" )
26
25
as_update = config_options .Type (Union [bool , str ], default = "git" )
27
26
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" )
29
28
default_timezone = config_options .Type (str , default = "UTC" )
30
29
31
30
Original file line number Diff line number Diff line change 16
16
from jinja2 import Environment , FileSystemLoader , select_autoescape
17
17
from mkdocs .config import config_options
18
18
from mkdocs .config .defaults import MkDocsConfig
19
- from mkdocs .exceptions import PluginError
20
19
from mkdocs .plugins import BasePlugin , event_priority , get_plugin_logger
21
20
from mkdocs .structure .files import Files
22
21
from mkdocs .structure .pages import Page
@@ -169,12 +168,13 @@ def on_config(self, config: MkDocsConfig) -> MkDocsConfig:
169
168
self .config .date_from_meta .default_time = datetime .strptime (
170
169
self .config .date_from_meta .default_time , "%H:%M"
171
170
)
172
- except ValueError as err :
173
- raise PluginError (
171
+ except ( TypeError , ValueError ) as err :
172
+ logger . warning (
174
173
"Config error: `date_from_meta.default_time` value "
175
174
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 } "
177
176
)
177
+ self .config .date_from_meta .default_time = "00:00"
178
178
179
179
if self .config .use_git :
180
180
logger .debug (
You can’t perform that action at this time.
0 commit comments