Code

gitweb: JavaScript ability to adjust time based on timezone
[git.git] / gitweb / static / js / lib / datetime.js
index b3dcedb14153acbb09d293dca1f4ec1363eb586a..f78c60a9125f0780611b9a3aae34970716cffc22 100644 (file)
@@ -104,6 +104,21 @@ function formatTimezoneInfo(hours, minutes, sep) {
        return tzSign + padLeft(hours, 2, '0') + sep + padLeft(minutes, 2, '0');
 }
 
+/**
+ * translate 'utc' and 'local' to numerical timezone
+ * @param {String} timezoneInfo: might be 'utc' or 'local' (browser)
+ */
+function normalizeTimezoneInfo(timezoneInfo) {
+       switch (timezoneInfo) {
+       case 'utc':
+               return '+0000';
+       case 'local': // 'local' is browser timezone
+               return localTimezoneInfo();
+       }
+       return timezoneInfo;
+}
+
+
 /**
  * return date in local time formatted in iso-8601 like format
  * 'yyyy-mm-dd HH:MM:SS +/-ZZZZ' e.g. '2005-08-07 21:49:46 +0200'