Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Babel's format_datetime, not format_date #6981

Merged
merged 2 commits into from
Mar 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions material/plugins/blog/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import posixpath
import yaml

from babel.dates import format_date
from babel.dates import format_datetime
from datetime import datetime
from jinja2 import pass_context
from jinja2.runtime import Context
Expand Down Expand Up @@ -783,7 +783,7 @@ def _format_path_for_pagination(self, view: View, page: int):
# Format date
def _format_date(self, date: datetime, format: str, config: MkDocsConfig):
locale: str = config.theme["language"].replace("-", "_")
return format_date(date, format = format, locale = locale)
return format_datetime(date, format = format, locale = locale)

# Format date for post
def _format_date_for_post(self, date: datetime, config: MkDocsConfig):
Expand Down