summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-04 15:02:08 -0700
committerJunio C Hamano <gitster@pobox.com>2011-04-04 15:02:08 -0700
commitfa38cfc2c6ce197960f85798aac18ee78aa83f1f (patch)
tree89f156b00f35fe5c92ac75c9ccf51f043fe65dd9
parent2071fb015bc673d2514142d7614b56a37b3faaf2 (diff)
parentd424a47e3400ef597a6f4f3c56ee67290f7c6052 (diff)
downloadgit-fa38cfc2c6ce197960f85798aac18ee78aa83f1f.tar.gz
Merge branch 'maint'
* maint: Documentation: trivial grammar fix in core.worktree description gitweb: Fix parsing of negative fractional timezones in JavaScript
-rw-r--r--Documentation/config.txt2
-rw-r--r--gitweb/static/gitweb.js24
2 files changed, 20 insertions, 6 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6d4dfa602e..750c86d4f5 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -320,7 +320,7 @@ core.worktree::
Set the path to the root of the working tree.
This can be overridden by the GIT_WORK_TREE environment
variable and the '--work-tree' command line option.
- The value can an absolute path or relative to the path to
+ The value can be an absolute path or relative to the path to
the .git directory, which is either specified by --git-dir
or GIT_DIR, or automatically discovered.
If --git-dir or GIT_DIR is specified but none of
diff --git a/gitweb/static/gitweb.js b/gitweb/static/gitweb.js
index 9c66928c4a..40ec08440b 100644
--- a/gitweb/static/gitweb.js
+++ b/gitweb/static/gitweb.js
@@ -399,7 +399,24 @@ function fixColorsAndGroups() {
* used to extract hours and minutes from timezone info, e.g '-0900'
* @constant
*/
-var tzRe = /^([+-][0-9][0-9])([0-9][0-9])$/;
+var tzRe = /^([+-])([0-9][0-9])([0-9][0-9])$/;
+
+/**
+ * convert numeric timezone +/-ZZZZ to offset from UTC in seconds
+ *
+ * @param {String} timezoneInfo: numeric timezone '(+|-)HHMM'
+ * @returns {Number} offset from UTC in seconds for timezone
+ *
+ * @globals tzRe
+ */
+function timezoneOffset(timezoneInfo) {
+ var match = tzRe.exec(timezoneInfo);
+ var tz_sign = (match[1] === '-' ? -1 : +1);
+ var tz_hour = parseInt(match[2],10);
+ var tz_min = parseInt(match[3],10);
+
+ return tz_sign*(((tz_hour*60) + tz_min)*60);
+}
/**
* return date in local time formatted in iso-8601 like format
@@ -408,14 +425,11 @@ var tzRe = /^([+-][0-9][0-9])([0-9][0-9])$/;
* @param {Number} epoch: seconds since '00:00:00 1970-01-01 UTC'
* @param {String} timezoneInfo: numeric timezone '(+|-)HHMM'
* @returns {String} date in local time in iso-8601 like format
- *
- * @globals tzRe
*/
function formatDateISOLocal(epoch, timezoneInfo) {
- var match = tzRe.exec(timezoneInfo);
// date corrected by timezone
var localDate = new Date(1000 * (epoch +
- (parseInt(match[1],10)*3600 + parseInt(match[2],10)*60)));
+ timezoneOffset(timezoneInfo)));
var localDateStr = // e.g. '2005-08-07'
localDate.getUTCFullYear() + '-' +
padLeft(localDate.getUTCMonth()+1, 2, '0') + '-' +