-
-
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
Continuation of #7725 which seems to still be present.
Bug description
When executing a build does the build error with TypeError: can't compare offset-naive and offset-aware datetime
Full Stacktrace from mkdocs build
:
$ mkdocs build
INFO - Cleaning site directory
INFO - Building documentation to directory: D:\GitHub\reproduction\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 "D:\GitHub\reproduction\venv\Scripts\mkdocs.exe\__main__.py", line 7, in <module>
File "D:\GitHub\reproduction\venv\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\mkdocs\__main__.py", line 288, in build_command
build.build(cfg, dirty=not clean)
File "D:\GitHub\reproduction\venv\Lib\site-packages\mkdocs\commands\build.py", line 292, in build
files = config.plugins.on_files(files, config=config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\mkdocs\plugins.py", line 593, in on_files
return self.run_event('files', files, config=config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\mkdocs\plugins.py", line 566, in run_event
result = method(item, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\material\plugins\blog\plugin.py", line 133, in on_files
self.blog.posts = sorted(
^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\material\plugins\blog\plugin.py", line 444, in _resolve_posts
if not self._is_excluded(post):
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GitHub\reproduction\venv\Lib\site-packages\material\plugins\blog\plugin.py", line 373, in _is_excluded
return post.config.date.created > datetime.now()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: can't compare offset-naive and offset-aware datetimes
The issue is most likely the usage of date: yyyy-mm-dd
without any timezones or time in general.
Note: Only mkdocs build
is affected. mkdocs serve
runs without any errors reported.
Related links
- Reporting a bug
- Blog plugin failing with TypeError: can't compare offset-naive and offset-aware datetimes on 9.5.45 #7725
Reproduction
Steps to reproduce
- Install Material for MkDocs 9.5.46
- Setup Blog plugin
- Create a post with a
date
frontmatter in the formatyyyy-mm-dd
- Execute
mkdocs build
Browser
No response
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.
mikethemanperpil
Metadata
Metadata
Assignees
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open