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

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

commit 84ebe38025ff81d4d10a63d35b843911a22fd3d7
Author: Daniel Gruno <[email protected]>
AuthorDate: Wed Nov 3 20:09:32 2021 +0100

    Add YUTC timestamp option, lint
---
 webui/js/config.js                    |  9 +++++----
 webui/js/source/base-js-extensions.js | 22 +++++++++++++++-------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/webui/js/config.js b/webui/js/config.js
index 79dce88..e0c08e4 100644
--- a/webui/js/config.js
+++ b/webui/js/config.js
@@ -62,15 +62,16 @@ var pm_config = {
 
 // Localized preferences (defaults)
 var prefs = {
-    subscribeLinks: false,           // Add subscribe button in stats pane?
+    subscribeLinks: false,          // Add subscribe button in stats pane?
     displayMode: 'threaded',        // threaded or flat
     groupBy: 'thread',              // thread or date
     sortOrder: 'forward',           // forward or reverse sort
-    compactQuotes: true,           // Show quotes from original email as 
compacted blocks?
+    compactQuotes: true,            // Show quotes from original email as 
compacted blocks?
     notifications: 'direct',        // Notify on direct or indirect replies to 
your posts?
-    hideStats: 'yes',                // Hide the email statistics window?
+    hideStats: 'yes',               // Hide the email statistics window?
     theme: 'default',               // Set to 'social' to default to the 
social theme
-    loggedIn: false
+    loggedIn: false,
+    UTC: false,                      // Use UTC for timestamps in UI. If 
false, use browser local time.
 }
 
 // array of prefs we have now. This is needed in case we change/break the 
existing
diff --git a/webui/js/source/base-js-extensions.js 
b/webui/js/source/base-js-extensions.js
index ea0fb48..20328d2 100644
--- a/webui/js/source/base-js-extensions.js
+++ b/webui/js/source/base-js-extensions.js
@@ -84,13 +84,21 @@ Number.prototype.pad = function(n) {
 
 /* Func for converting a date to YYYY-MM-DD HH:MM */
 
-Date.prototype.ISOBare = function() {
-    var M, d, h, m, y;
-    y = this.getFullYear();
-    m = (this.getMonth() + 1).pad(2);
-    d = this.getDate().pad(2);
-    h = this.getHours().pad(2);
-    M = this.getMinutes().pad(2);
+Date.prototype.ISOBare = function(utc = false) {
+    let M, 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);
+    } 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);
+    }
     return y + "-" + m + "-" + d + " " + h + ":" + M;
 };
 

Reply via email to