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

Allow using GMT in the HTML last updated format #12907

Merged
merged 1 commit into from
Sep 22, 2024

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Sep 22, 2024

Feature or Bugfix

  • Feature

Purpose

Add html_last_updated_time_zone to allow using GMT (universal time) instead of local time for the date-time supplied to html_last_updated_fmt.

Detail

This is useful when html_last_updated_fmt includes hours or minutes, and when working on a project that spans time zones. For example, the Python project (at time of writing) overwrites html_last_updated_fmt with a static time as local time is unhelpful.

A

@AA-Turner AA-Turner added the type:enhancement enhance or introduce a new feature label Sep 22, 2024
@AA-Turner AA-Turner added this to the 8.x milestone Sep 22, 2024
@AA-Turner AA-Turner merged commit 45b7ebd into sphinx-doc:master Sep 22, 2024
22 checks passed
@AA-Turner AA-Turner deleted the html-lufmt-localtime branch September 22, 2024 06:55
@mgeier
Copy link
Contributor

mgeier commented Sep 22, 2024

Wouldn't it be more useful to be able to specify an arbitrary time zone instead of only having GMT as a choice?

This is how I did it in my sphinx_last_updated_by_git extension: https://github.com/mgeier/sphinx-last-updated-by-git/blob/7d226ef95ff2e19caaddc5018fb86f1bbf304232/src/sphinx_last_updated_by_git.py#L258-L263

Also, I'm not sure if "GMT" is the right term. Shouldn't it be "UTC"?

@AA-Turner
Copy link
Member Author

Perhaps, but I'm not particularly fond of adding more options. By default I think continuing to target the local timezone is the right choice.

The option here is to use a standard time, for which GMT/UTC/Universal time seemed most appropriate. To my knowledge there haven't been any requests to configure timezones?

A

@mgeier
Copy link
Contributor

mgeier commented Oct 3, 2024

To my knowledge there haven't been any requests to configure timezones?

No, I didn't get any requests.

I just find it strange to provide a "timezone" configuration and then only allow 'local' | 'GMT'.

When I hear "timezone", I'm expecting to be able to select any time zone I want, not only one.

@AA-Turner
Copy link
Member Author

Perhaps we could rename? use_local_timezone / use_system_timezone / use_gmt / ??

A

@mgeier
Copy link
Contributor

mgeier commented Oct 3, 2024

Yes, those names would be more consistent.

It should probably be prefixed with html_last_updated_, though.

Who actually requested this? Maybe they should chime in?

I would also suggest again to re-think whether "GMT" is the right name.

I just tried it and when I'm specifying:

html_last_updated_fmt = '%Y-%m-%d %H:%M:%S %Z'

... then I'm getting this:

Last updated on 2024-10-03 16:29:34 UTC.

So maybe using "UTC" would be more appropriate?

If you are interested, you can also try my extension https://github.com/mgeier/sphinx-last-updated-by-git, where I'm getting this mapping:

  • 'UTC' -> "UTC"
  • 'GMT' -> "GMT"
  • 'Europe/London' -> "GMT" for a date in winter and "+0100" for DST

@AA-Turner AA-Turner modified the milestones: 8.x, 8.1.0 Oct 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants