git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 00/11] gitweb: Change timezone

From
Kevin Cernekee <cernekee@gmail.com>
Date
Apr 12, 2011, 01:19 UTC
Message-ID
<BANLkTik9D6++P1rg+VbvKj9oTFhRYNmrpQ@mail.gmail.com>
In-Reply-To
<1302389366-21515-1-git-send-email-jnareb@gmail.com>
On Sat, Apr 9, 2011 at 3:49 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> This is split version (with assorted cleanups) of J.H. patch adding
> JavaScript-base ability to change timezone in which dates are
> displayed.
Jakub,

Thanks for the update. This UI does seem to work better than the original "[+]" dropdown interface.

The new code appears to degrade gracefully on IE6 (everything shown in UTC).
Tests on Firefox 3.6.15 looked OK.
Chromium 6.0.472.62 (59676) does not like this operation:
Uncaught Error: NOT_FOUND_ERR: DOM Exception 8
  removeChangeTZForm
  /gitweb-static/gitweb.js:785
onTZFormChange
line 785: var removed = container.removeChild(container.lastChild);

Opera 10.63 resets target.selectedIndex to 1 after calling removeChangeTZForm() from onTZFormChange(). Net effect is that you're always stuck in the "local" zone. Here is a workaround that fixed it for me:

       var target = event.target || event.srcElement;
       var selectedIndex = target.selectedIndex;
       removeChangeTZForm(documentFragment, target, tzClassName);
       var selected = target.options.item(selectedIndex);
Couple other random nitpicks:
> +	// server-side of gitweb produces datetime in UTC,
> +	// so if tz is 'utc' there is no need for changes
> +	var nochange = tz === 'utc';
If I delete my gitweb_tz cookie, then refresh the page:
 - All times show up in my browser's local time (good)
 - Clicking UTC/GMT on the dropdown has no immediate effect; I need to
   refresh the page again to see the times change (bad)
> +	my (undef, undef, $datetime_class) =
> +		gitweb_get_feature('javascript-timezone');
> +	if ($datetime_class) {
> +		$strtime = qq!<span class="datetime">$strtime</span>!;

Should this hard-code class "datetime", or use $datetime_class from the gitweb server configuration?

> +/* JavaScript-base timezone manipulation */
Might want to reword as "JavaScript-based"
> +		// refresh cookie, so it expires 7 days from last use of gitweb
> +		setCookie(tzCookieName, tzCookie, { expires: 7, path: '/' });
Hmm, only 7 days?
> + * and instals appropriate onclick trigger (via event delegation).
"installs"
Previous: Jakub NarebskiNext: Jakub Narebski
Message 16 of 19 in “gitweb: Change timezone”
  1. 00/11 gitweb: Change timezoneJakub Narebski, Apr 9, 2011
  2. 01/11 gitweb: Split JavaScript for maintability, combining on buildJakub Narebski, Apr 9, 2011
  3. 02/11 gitweb.js: Update and improve comments in JavaScript filesJakub Narebski, Apr 9, 2011
  4. 03/11 gitweb.js: Provide default values for padding in padLeftStr and padLeftJakub Narebski, Apr 9, 2011
  5. 04/11 gitweb.js: Extract and improve datetime handlingJakub Narebski, Apr 9, 2011
  6. 05/11 gitweb.js: Introduce gitweb/static/js/lib/cookies.jsJakub Narebski, Apr 9, 2011
  7. 06/11 gitweb.js: Provide getElementsByClassName method (if it not exists)Jakub Narebski, Apr 9, 2011
  8. 07/11 gitweb: Refactor generating of long dates into format_timestamp_htmlJakub Narebski, Apr 9, 2011
  9. 08/11 gitweb: Unify the way long timestamp is displayedJakub Narebski, Apr 9, 2011
  10. 09/11 gitweb: JavaScript ability to adjust time based on timezoneJakub Narebski, Apr 9, 2011
  11. 10/11 gitweb.js: Add UI for selecting common timezone to display datesJakub Narebski, Apr 9, 2011
  12. Jakub NarebskiApr 10, 2011
  13. Jakub NarebskiApr 10, 2011
  14. Jakub NarebskiApr 10, 2011
  15. 11/11 gitweb: Make JavaScript ability to adjust timezones configurableJakub Narebski, Apr 9, 2011
  16. Kevin CernekeeApr 12, 2011
  17. Jakub NarebskiApr 12, 2011
  18. 10/11 gitweb.js: Add UI for selecting common timezone to display datesJakub Narebski, Apr 12, 2011
  19. 11/11 gitweb: Make JavaScript ability to adjust timezones configurableJakub Narebski, Apr 12, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.