Skip to content

Commit a94db33

Browse files
authored
Fallback of current timestamp in always in UTC timezone
1 parent fbce255 commit a94db33

File tree

1 file changed

+2
-2
lines changed
  • mkdocs_git_revision_date_localized_plugin

1 file changed

+2
-2
lines changed

mkdocs_git_revision_date_localized_plugin/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_revision_date_for_file(self, path: str, locale: str = 'en'):
2222
unix_timestamp = self.g.log(path, n=1, date='short', format='%at')
2323

2424
if not unix_timestamp:
25-
unix_timestamp = datetime.now().timestamp()
25+
unix_timestamp = datetime.utcnow().timestamp()
2626
print('WARNING - %s has no git logs, using current timestamp' % path)
2727

2828
unix_timestamp = int(unix_timestamp)
@@ -36,4 +36,4 @@ def get_revision_date_for_file(self, path: str, locale: str = 'en'):
3636
'iso_date' : revision_date.strftime("%Y-%m-%d"),
3737
'iso_datetime' : revision_date.strftime("%Y-%m-%d %H:%M:%S"),
3838
'timeago' : "<span class='timeago' datetime='%s' locale='%s'></span>" % (timestamp_in_ms, locale)
39-
}
39+
}

0 commit comments

Comments
 (0)