-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open
Description
Context
No response
Bug description
mkdocs build --strict
fails on 9.5.45 with the error below:
mkdocs build -s
INFO - Cleaning site directory
INFO - Building documentation to directory: D:\temp\20241120\mkdocs\site
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Scripts\mkdocs.exe\__main__.py", line 7, in <module>
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\mkdocs\__main__.py", line 288, in build_command
build.build(cfg, dirty=not clean)
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\mkdocs\commands\build.py", line 292, in build
files = config.plugins.on_files(files, config=config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\mkdocs\plugins.py", line 593, in on_files
return self.run_event('files', files, config=config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\mkdocs\plugins.py", line 566, in run_event
result = method(item, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Mikhail\AppData\Local\Programs\Python\Python312\Lib\site-packages\material\plugins\blog\plugin.py", line 133, in on_files
self.blog.posts = sorted(
^^^^^^^
TypeError: can't compare offset-naive and offset-aware datetimes
9.5.38 works fine.
I constructed a minimal reproduction test case, and based on this, the error is thrown when I have two formats of date.created
:
- yyyy-mm-dd (e.g.
created: 2024-09-06
) - yyyy-mm-ddThh:mi:ss (e.g.
created: 2019-02-25T04:25:00
)
Both formats are supported per the documentation: https://squidfunk.github.io/mkdocs-material/plugins/blog/#meta.date
If I remove any of the files and keep only one format, there is no error.
Related links
- Reporting a bug
- Blog plugin failing with
TypeError: can't compare offset-naive and offset-aware datetimes
#7705
Reproduction
9.5.45-typerror-cannot-compare-datetimes.zip
Steps to reproduce
pip install .
(the reproduction file haspyproject.toml
)mkdocs build --strict
- should fail ❌pip install mkdocs-material==9.5.38
mkdocs build --strict
- should work✔
Browser
Firefox
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues and discussions.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction using the built-in info plugin.
Andre601 and practicalli-johnny
Metadata
Metadata
Assignees
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open