Skip to content

Commit b52364a

Browse files
Improve the fix
1 parent ab88e1f commit b52364a

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

neoteroi/mkdocs/contribs/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ def _get_last_commit_date(self, page_file: File) -> datetime:
158158
def _set_contributors(self, markdown: str, page: Page) -> str:
159159
page_file = page.file
160160
last_commit_date = self._get_last_commit_date(page_file)
161+
162+
if last_commit_date.replace(tzinfo=None) == datetime.min:
163+
# The page was never committed, skip
164+
return markdown
165+
161166
contributors = self._get_contributors(page_file)
162167
return (
163168
markdown

neoteroi/mkdocs/contribs/git.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
from pathlib import Path
1212
from typing import Iterable, List, Tuple
1313

14-
from dateutil.parser import parse as parse_date, ParserError
14+
from dateutil.parser import ParserError
15+
from dateutil.parser import parse as parse_date
1516

1617
from neoteroi.mkdocs.contribs.domain import ContributionsReader, Contributor
1718

neoteroi/mkdocs/contribs/html.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ def contribution_stats_to_element(
3131
) -> etree.Element:
3232
element = etree.Element("div", {"class": "nt-contribs"})
3333

34-
if (
35-
options.show_last_modified_time
36-
and last_commit_date.replace(tzinfo=None) > datetime.min
37-
):
34+
if options.show_last_modified_time:
3835
last_modified_time = etree.SubElement(
3936
element,
4037
"p",

0 commit comments

Comments
 (0)