sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.46k stars 2.1k forks source link

'Last updated on:' timestamp should use browsers locale timezone #11738

Open buhtz opened 11 months ago

buhtz commented 11 months ago

Is your feature request related to a problem? Please describe. Readers of my docu around the world can not be sure about when it was generated. It is because of different timezones they are in. As a workaround I do use "%Z" in "html_last_updated_fmt". But this is not user friendly because they have to do calculations related to their own timezone.

Describe the solution you'd like The displayed (in HTML) time should always use the current users locale. The locale of the browser used to access the docu. Not the locale used by the machine running sphinx. I am not into webdesign but I assume some javascript is needed for this?

Describe alternatives you've considered Using "%Z"

Additional context Here is one of the related docs https://bit-testing-readthedocs.readthedocs.io/en/latest/

picnixz commented 9 months ago

The locale of the browser used to access the docu

So it's only on the rendering part? the thing is that we hardcode the footer in the basic themes. We could do something for those basic themes where they would render differntly but that means adding some Javascript. So if anyone wants to do it, they need to update all bundled themes.

Actually, what is happening is that we pass the formatted string last_updated which contains the time (of the machine generating the doc) when it was last updated. Then the theme modifies it however it deems fit, but basic themes simply use that string directly: https://github.com/sphinx-doc/sphinx/blob/35965903177c6ed9a6afb62ccd33243a746a3fc0/sphinx/themes/basic/layout.html#L211-L213