From 572ba7da8411f0699e7c1ddc6813a9c623ffe807 Mon Sep 17 00:00:00 2001 From: lex3001 Date: Sun, 3 May 2020 12:44:40 -0700 Subject: [PATCH 1/2] Update GmailUtils.gs --- GmailUtils.gs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/GmailUtils.gs b/GmailUtils.gs index 9f8aaa9..8f56476 100644 --- a/GmailUtils.gs +++ b/GmailUtils.gs @@ -476,8 +476,8 @@ function formatEmails_(emails) { * @param {string} class * @return {boolean} */ -function isa_(obj, class) { - return typeof obj == 'object' && typeof obj.constructor == 'undefined' && obj.toString() == class; +function isa_(obj, className) { + return typeof obj == 'object' && (typeof obj.constructor == 'undefined' || typeof obj.constructor == 'function') && obj.toString() == className; } /** @@ -500,8 +500,21 @@ function defaults_(options, defaults) { * @return {string} */ function localTimezone_() { - var timezone = new Date().toTimeString().match(/\(([a-z0-9]+)\)/i); - return timezone.length ? timezone[1] : 'GMT'; + // 19:26:50 GMT-0700 (Pacific Daylight Time) + // 19:29:40 GMT-0700 (PDT) + //Logger.log('Hello=' + new Date().toTimeString()); + //console.log('Hello=' + new Date().toTimeString()); + //var timezone = new Date().toTimeString().match(/\(([a-z 0-9]+)\)/i); + //return timezone.length ? timezone[1] : 'GMT'; + var tz = gettz_(); + return tz ? tz : 'GMT'; +} + +function gettz_() { + var d = new Date(); // now, or the specific date in question + var s = d.toLocaleString("en", {timeZoneName: "short"}).split(' ').pop(); + //Logger.log(s); + return s; } /** @@ -525,4 +538,3 @@ function md5_(str) { chr = (chr < 0 ? chr + 256 : chr).toString(16); return str + (chr.length==1?'0':'') + chr; },''); -} From 009abd4a1b7d139e9b505e1006a72b8556a9f8ff Mon Sep 17 00:00:00 2001 From: lex3001 Date: Sun, 3 May 2020 12:44:44 -0700 Subject: [PATCH 2/2] Update GmailUtils.gs --- GmailUtils.gs | 1 + 1 file changed, 1 insertion(+) diff --git a/GmailUtils.gs b/GmailUtils.gs index 8f56476..b1f111f 100644 --- a/GmailUtils.gs +++ b/GmailUtils.gs @@ -538,3 +538,4 @@ function md5_(str) { chr = (chr < 0 ? chr + 256 : chr).toString(16); return str + (chr.length==1?'0':'') + chr; },''); +} \ No newline at end of file