summaryrefslogtreecommitdiff
path: root/roundcubemail/program/js/common.js
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-09-28 11:49:37 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-09-28 11:49:37 +0000
commit9800e5a3307cb11d418bb77b651ca52d3375090f (patch)
tree31b9fc17907bdce04203b155bfd8e768090a0d4e /roundcubemail/program/js/common.js
parent48abf2044873af889cd3a69f5d8dfb9485f2baae (diff)
Distinguish standard timezone offset and DST of client
git-svn-id: https://svn.roundcube.net/trunk@5285 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/js/common.js')
-rw-r--r--roundcubemail/program/js/common.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/roundcubemail/program/js/common.js b/roundcubemail/program/js/common.js
index f69125bcc..831e44a21 100644
--- a/roundcubemail/program/js/common.js
+++ b/roundcubemail/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)