Go to file
Alexander Payne abfac1a93e
Switched to Babel's format_datetime to allow for time in formatted dates (#6981)
* Use Babel's `format_datetime`, not `format_date`

I am using MkDocs-Material 9.5.15 and Babel 2.14.0. When setting the config value `blog.post_date_format: "yyyy-MM-dd hh:mm:ss"`, the blog plugin crashes during compilation with the error "date objects have no hour field".

I believe this is occurring because the plugin provides a `datetime` to `babel.dates.format_date`, which upcasts it to a plain, timeless, `date`. Making this change to use `babel.dates.format_datetime` instead resolved the error and demonstrated expected behavior.

While I recognize that it is likely uncommon for a blog to want to include sub-date timestamps in any of these fields, I believe that the current documentation,

> The format string must adhere to babel's pattern syntax and should not contain whitespace

implies that _any_ of Babel's pattern markers are acceptable here. I would consider 

> The format string must adhere to Babel's pattern syntax for calendar dates and should not contain whitespace

to also be a sufficient fix for this case.

----

Thank you for your effort in creating this project; it has been a wonderful benefit to my team, and this is the first minor problem we've had in months of using it.

* Make the change in src/, not material/
2024-03-31 15:45:47 +08:00
.devcontainer Updated Premium sponsors 2023-07-07 09:37:30 +02:00
.github Updated Premium sponsors 2024-03-06 13:22:40 +07:00
.vscode Updated launch configurations 2023-10-06 15:18:28 +02:00
docs Updated dependencies 2024-03-27 18:11:52 +08:00
includes Documentation 2024-02-19 12:48:18 +07:00
material Switched to Babel's format_datetime to allow for time in formatted dates (#6981) 2024-03-31 15:45:47 +08:00
src Switched to Babel's format_datetime to allow for time in formatted dates (#6981) 2024-03-31 15:45:47 +08:00
tools/build Fixed info plugin's exclusion logic (#6874) 2024-03-12 09:55:15 +07:00
typings Updated copyright year 2024-01-06 09:27:06 +07:00
.browserslistrc Added polyfills for unfetch, URL, Object.entries and Element.scrollTo 2022-01-06 20:57:06 +01:00
.dockerignore Updated copyright year 2024-01-06 09:27:06 +07:00
.editorconfig Updated copyright year 2024-01-06 09:27:06 +07:00
.eslintignore Updated copyright year 2024-01-06 09:27:06 +07:00
.eslintrc Fixed linter errors after last upgrade 2023-04-19 19:05:55 +02:00
.gitattributes Fixed line feeds on Windows (#1614) 2020-04-17 10:02:43 +02:00
.gitignore Updated copyright year 2024-01-06 09:27:06 +07:00
.stylelintignore Updated copyright year 2024-01-06 09:27:06 +07:00
.stylelintrc Fixed deprecated stylelint rules 2023-09-25 17:36:36 +02:00
CHANGELOG Updated Insiders changelog 2024-03-23 13:38:07 +08:00
CODE_OF_CONDUCT.md Merge branch 'master' into docs/guides 2023-09-21 14:53:33 +02:00
CONTRIBUTING.md Documentation 2023-09-21 15:57:54 +02:00
Dockerfile Formatting 2024-03-13 09:14:16 +07:00
giscus.json Added origins in giscus.json to omit discussion spam 2022-03-22 19:03:31 +01:00
LICENSE Updated copyright year 2024-01-06 09:27:06 +07:00
mkdocs.yml Moved contribution guides to community section 2024-03-08 13:55:38 +07:00
package-lock.json Updated dependencies 2024-03-27 18:11:52 +08:00
package.json Updated dependencies 2024-03-27 18:11:52 +08:00
pyproject.toml Prepare 9.5.8 release 2024-02-07 10:32:47 +07:00
README.md Updated Premium sponsors 2024-03-06 13:22:40 +07:00
requirements.txt Updated copyright year 2024-01-06 09:27:06 +07:00
setup.py Updated copyright year 2024-01-06 09:27:06 +07:00
tsconfig.json Fixed .dockerignore after restructuring 2023-09-20 14:11:10 +02:00

Material for MkDocs

A powerful documentation framework on top of MkDocs

Build Downloads Python Package Index Docker Pulls Sponsors

Write your documentation in Markdown and create a professional static site for your Open Source or commercial project in minutes searchable, customizable, more than 60 languages, for all devices.

Check out the demo squidfunk.github.io/mkdocs-material.

 

Silver sponsors

 

Bronze sponsors

 

Everything you would expect

It's just Markdown

Focus on the content of your documentation and create a professional static site in minutes. No need to know HTML, CSS or JavaScript let Material for MkDocs do the heavy lifting for you.

Works on all devices

Serve your documentation with confidence Material for MkDocs automatically adapts to perfectly fit the available screen estate, no matter the type or size of the viewing device. Desktop. Tablet. Mobile. All great.

Made to measure

Make it yours change the colors, fonts, language, icons, logo, and more with a few lines of configuration. Material for MkDocs can be easily extended and provides many options to alter appearance and behavior.

Fast and lightweight

Don't let your users wait get incredible value with a small footprint by using one of the fastest themes available with excellent performance, yielding optimal search engine rankings and happy users that return.

Built for everyone

Make accessibility a priority users can navigate your documentation with touch devices, keyboards, and screen readers. Semantic markup ensures that your documentation works for everyone.

Open Source

Trust 20,000+ users choose a mature and actively maintained solution built with state-of-the-art Open Source technologies. Keep ownership of your content without fear of vendor lock-in. Licensed under MIT.

Quick start

Material for MkDocs can be installed with pip:

pip install mkdocs-material

Add the following lines to mkdocs.yml:

theme:
  name: material

For detailed installation instructions, configuration options, and a demo, visit squidfunk.github.io/mkdocs-material

Trusted by ...

... industry leaders

ArXiv, Atlassian, AWS, Bloomberg, CERN, CloudFlare, Datadog, Google, Hewlett Packard, ING, Intel, JetBrains, LinkedIn, Microsoft, Mozilla, Netflix, Red Hat, Salesforce, SIEMENS, Slack, Square, Zalando

... and successful Open Source projects

Arduino, Auto-GPT, AutoKeras, BFE, CentOS, Crystal, Electron, FastAPI, GoReleaser, Knative, Kubernetes, kSQL, Nokogiri, OpenFaaS, Percona, Pi-Hole, Pydantic, PyPI, Renovate, Traefik, Trivy, Vapor, ZeroNet, WebKit, WTF

License

MIT License

Copyright (c) 2016-2024 Martin Donath

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.