Comments (3)
I just released v0.6
adding support for timezones, which should address this issue.
pip install --upgrade mkdocs-git-revision-date-localized-plugin
# mkdocs.yml
plugins:
- git-revision-date-localized:
type: datetime
locale: zh
time_zone: Asia/Shanghai
Let me know what you think?
from mkdocs-git-revision-date-localized-plugin.
Hi @flc1125,
Thanks for taking the time to investigate and report. Much appreciated!
All timestamps are currently being reported in UTC
(+0) format. That's not sufficiently clear from the documentation (yet). Timezones should be supported by the plugin.
Technical background
We're retrieving the unix timestamp from GIT:
(Note that %at
retrieves the "author date, UNIX timestamp" reference
The UNIX timestamp is timezone independant as it's "the number of seconds (or milliseconds) elapsed since an absolute point in time, midnight of Jan 1 1970 in UTC time".
When formatting time (for type="datetime"
), there's no timezone conversion:
Solution
The solution would be to add timezone support for displaying time. The locale
and timezone
are only very loosely coupled: you might have English sites in China en vice versa. So this would have to be a separate, additional option of the plugin.
This package usesbabel
for localization, which already supports timezones, so an implementation would be fairly straightforward and alone the lines of:
from babel.dates import format_date, format_time, get_timezone
tzinfo = get_timezone("Asia/Shanghai")
format_time(revision_date, format="medium", locale = "zh", tzinfo=tzinfo)
The timeago
plugin also accepts an ISO 8601 string where you specify the timezone as well.
I'll spend some time on this somewhere this week and release a new version with timezone support!
from mkdocs-git-revision-date-localized-plugin.
你好,我已经升级成功,已经正常。
非常棒,太高效了,非常非常感谢你。:+1::+1:
from mkdocs-git-revision-date-localized-plugin.
Related Issues (20)
- Edited and Created time become same when publishing with github pages HOT 7
- ``InvalidGitRepositoryError`` during build when including auto-generated files HOT 8
- Unable to set any configurations HOT 12
- Typo in variable names HOT 2
- The plugin breaks with the last mkdocs docker image HOT 3
- The plugin breaks with squidfunk/mkdocs-material:9.0.3 HOT 1
- Is there a way to turn off warnings? HOT 4
- Improve error message for dubious git ownership HOT 2
- if a file has no git logs, use the last modified timestamp instead of the current HOT 4
- which themes will this plugin work?
- Feature request: exclude specific commits when calculating the 'last update' calculation HOT 3
- Poor performance on large monorepos HOT 3
- Timeago setting results in incorrect items being added to extra_javascript HOT 2
- Create date not correct on Github pages HOT 4
- Document how to use sparse checkouts
- correctly populate `lastmod` of `sitemap.xml` HOT 2
- DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version HOT 1
- Cloudflare Pages fetch-depth HOT 6
- 1.2.3 breaks integration with Material for MkDocs HOT 5
- Whitelist / Negate certain excludes with a `!`? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdocs-git-revision-date-localized-plugin.