This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new f6ecec4  Show the TZ in use
f6ecec4 is described below

commit f6ecec443b055dcaded783efe2783fab70ec48c0
Author: Sebb <[email protected]>
AuthorDate: Wed Nov 10 14:05:02 2021 +0000

    Show the TZ in use
    
    Also drop unused ISOBare parameter
---
 webui/js/ponymail.js                  | 21 +++++++++++++++++----
 webui/js/source/base-js-extensions.js | 21 +++++++++++++++++----
 2 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index 3bd0068..c8c6b31 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -202,25 +202,38 @@ Number.prototype.pad = function(n) {
     return str;
 };
 
+/* Func for converting TZ offset from minutes to +/-HHMM */
+
+Date.prototype.TZ_HHMM = function() {
+    var off_mins = this.getTimezoneOffset();
+    var off_hh =   Math.floor(Math.abs(off_mins/60));
+    var off_mm =   Math.abs(off_mins%60);
+    var sgn = off_mins > 0 ? '-' : '+';
+    return sgn + off_hh.pad(2) + ':' + off_mm.pad(2);
+}
+
+
 
-/* Func for converting a date to YYYY-MM-DD HH:MM */
+/* Func for converting a date to YYYY-MM-DD HH:MM TZ */
 
-Date.prototype.ISOBare = function(utc = false) {
-    let M, d, h, m, y;
+Date.prototype.ISOBare = function() {
+    let M, O, d, h, m, y;
     if (prefs.UTC === true) {
         y = this.getUTCFullYear();
         m = (this.getUTCMonth() + 1).pad(2);
         d = this.getUTCDate().pad(2);
         h = this.getUTCHours().pad(2);
         M = this.getUTCMinutes().pad(2);
+        O = 'UTC';
     } else {
         y = this.getFullYear();
         m = (this.getMonth() + 1).pad(2);
         d = this.getDate().pad(2);
         h = this.getHours().pad(2);
         M = this.getMinutes().pad(2);
+        O = this.TZ_HHMM();
     }
-    return y + "-" + m + "-" + d + " " + h + ":" + M;
+    return y + "-" + m + "-" + d + " " + h + ":" + M + " " + O;
 };
 
 
diff --git a/webui/js/source/base-js-extensions.js 
b/webui/js/source/base-js-extensions.js
index 20328d2..60d3fc1 100644
--- a/webui/js/source/base-js-extensions.js
+++ b/webui/js/source/base-js-extensions.js
@@ -81,25 +81,38 @@ Number.prototype.pad = function(n) {
     return str;
 };
 
+/* Func for converting TZ offset from minutes to +/-HHMM */
+
+Date.prototype.TZ_HHMM = function() {
+    var off_mins = this.getTimezoneOffset();
+    var off_hh =   Math.floor(Math.abs(off_mins/60));
+    var off_mm =   Math.abs(off_mins%60);
+    var sgn = off_mins > 0 ? '-' : '+';
+    return sgn + off_hh.pad(2) + ':' + off_mm.pad(2);
+}
+
+
 
-/* Func for converting a date to YYYY-MM-DD HH:MM */
+/* Func for converting a date to YYYY-MM-DD HH:MM TZ */
 
-Date.prototype.ISOBare = function(utc = false) {
-    let M, d, h, m, y;
+Date.prototype.ISOBare = function() {
+    let M, O, d, h, m, y;
     if (prefs.UTC === true) {
         y = this.getUTCFullYear();
         m = (this.getUTCMonth() + 1).pad(2);
         d = this.getUTCDate().pad(2);
         h = this.getUTCHours().pad(2);
         M = this.getUTCMinutes().pad(2);
+        O = 'UTC';
     } else {
         y = this.getFullYear();
         m = (this.getMonth() + 1).pad(2);
         d = this.getDate().pad(2);
         h = this.getHours().pad(2);
         M = this.getMinutes().pad(2);
+        O = this.TZ_HHMM();
     }
-    return y + "-" + m + "-" + d + " " + h + ":" + M;
+    return y + "-" + m + "-" + d + " " + h + ":" + M + " " + O;
 };
 
 

Reply via email to