]> Lady’s Gitweb - Gitweb/commit
gitweb.js: Extract and improve datetime handling
authorJakub Narebski <redacted>
Thu, 28 Apr 2011 19:04:04 +0000 (21:04 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:31 +0000 (00:51 -0400)
commit47fe8fa87b01872f5ab58f2bd0e3ddc9ed5e11868698098ad082a3298a035e0d
tree819072c693f6078bf8bcf36b8bbc7a49d53d72cfdfd945771ac1a3ce1eaad78c
parent93870fd1862afe544366ddd5e206c57648c8595f143f68a1ad0701c82d01fb18
gitweb.js: Extract and improve datetime handling

Move formatDateISOLocal(epoch, timezone) function (and also helper
timezoneOffset(timezoneInfo) function it requires) from common-lib.js to
datetime.js

Add new functions:
* localTimezoneOffset - to get browser timezone offset in seconds
* localTimezoneInfo   - to get browser timezone in '(+|-)HHMM' format
* formatTimezoneInfo - turn offset in hours and minutes into '(+|-)HHMM'
* parseRFC2822Date - to parse RFC-2822 dates that gitweb uses into epoch
* formatDateRFC2882 - like formatDateISOLocal, only RFC-2822 format

All those functions are meant to be used in future commit
'gitweb: javascript ability to adjust time based on timezone'

An alternative would be to use e.g. Datejs (http://www.datejs.com)
library, or JavaScript framework that has date formatting (perhaps as
a plugin).

While at it escape '-' in character class inside tzRe regexp, as
recommended by JSLint (http://www.jslint.com).

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
Makefile
static/js/lib/common-lib.js
static/js/lib/datetime.js [new file with mode: 0644]
This page took 0.316148 seconds and 4 git commands to generate.