summaryrefslogtreecommitdiff
path: root/program/js/common.js
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-09-28 11:49:37 +0000
committerthomascube <thomas@roundcube.net>2011-09-28 11:49:37 +0000
commit65082b3adbfaa04c4aff7c41147bb43e34941106 (patch)
tree193989ac4b845ed55db352c7790f5f10fab9f347 /program/js/common.js
parent1991b77ace5fe11fc897ac4795c9f9771f6ae57c (diff)
Distinguish standard timezone offset and DST of client
Diffstat (limited to 'program/js/common.js')
-rw-r--r--program/js/common.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/program/js/common.js b/program/js/common.js
index f69125bcc..831e44a21 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -671,6 +671,23 @@ RegExp.escape = function(str)
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
};
+// Extend Date prototype to detect Standard timezone without DST
+// from http://www.michaelapproved.com/articles/timezone-detect-and-ignore-daylight-saving-time-dst/
+Date.prototype.getStdTimezoneOffset = function()
+{
+ var m = 12,
+ d = new Date(null, m, 1),
+ tzo = d.getTimezoneOffset();
+
+ while (--m) {
+ d.setUTCMonth(m);
+ if (tzo != d.getTimezoneOffset()) {
+ return Math.max(tzo, d.getTimezoneOffset());
+ }
+ }
+
+ return tzo;
+}
// Make getElementById() case-sensitive on IE
if (bw.ie)