]> Lady’s Gitweb - Gitweb/commit
gitweb: JavaScript ability to adjust time based on timezone
authorJohn 'Warthog9' Hawley <redacted>
Thu, 28 Apr 2011 19:04:09 +0000 (21:04 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:31 +0000 (00:51 -0400)
commite301db1d49799c3f6cce05ac75438cd76254de83cb4675c7b45e9019abcb6306
tree889e99ad83d5570f1782e2eefe50c86c0b38f9a8f848afe4a8cd44bc08575379
parent66d984589fe19ceefaf5a2d5840d3843664b7f12753457ca516354553b2236da
gitweb: JavaScript ability to adjust time based on timezone

This patch is based on Kevin Cernekee's <redacted>
patch series entitled "gitweb: introduce localtime feature".  While
Kevin's patch changed the server side output so that the timezone
was output from gitweb itself, this has a number of drawbacks, in
particular with respect to gitweb-caching.

This patch takes the same basic goal, display the appropriate times in
a given common timezone, and implements it in JavaScript.  This
requires adding / using a new class, "datetime", to be able to find
elements to be adjusted from JavaScript.  Appropriate dates are
wrapped in a span with this class.

Timezone to be used can be retrieved from "gitweb_tz" cookie, though
currently there is no way to set / manipulate this cookie from gitweb;
this is left for later commit.

Valid timezones, currently, are: "utc", "local" (which means that
timezone is taken from browser), and "+/-ZZZZ" numeric timezone as in
RFC-2822.  Default timezone is "local" (currently not configurable,
left for later commit).

Fallback (should JavaScript not be enabled) is to treat dates as they
have been and display them, only, in UTC.

Pages affected:
* 'summary' view, "last change" field (commit time from latest change)
* 'log' view, author time
* 'commit' and 'commitdiff' views, author/committer time
* 'tag' view, tagger time

Based-on-code-from: Kevin Cernekee <redacted>
Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
Makefile
gitweb.perl
static/js/adjust-timezone.js [new file with mode: 0644]
static/js/lib/datetime.js
This page took 0.314061 seconds and 4 git commands to generate.