that displays the simulated times in UTC instead of the local timezone
Only takes effect on the next click of 'Simulate'

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
wanted to make it clearer that the time is the Local timezone by default,
not sure if it does that...

 www/manager6/window/ScheduleSimulator.js | 26 ++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/www/manager6/window/ScheduleSimulator.js 
b/www/manager6/window/ScheduleSimulator.js
index 7e708b43f..e4b4397f2 100644
--- a/www/manager6/window/ScheduleSimulator.js
+++ b/www/manager6/window/ScheduleSimulator.js
@@ -34,12 +34,23 @@ Ext.define('PVE.window.ScheduleSimulator', {
 
        renderDate: function(value) {
            let date = new Date(value*1000);
-           return date.toLocaleDateString();
+
+           if (this.getViewModel().get('utc')) {
+               return date.toLocaleDateString(undefined, { timeZone: 'UTC' });
+           }
+           else {
+               return date.toLocaleDateString();
+           }
        },
 
        renderTime: function(value) {
            let date = new Date(value*1000);
-           return date.toLocaleTimeString();
+           if (this.getViewModel().get('utc')) {
+               return date.toLocaleTimeString(undefined, { timeZone: 'UTC' });
+           }
+           else {
+               return date.toLocaleTimeString();
+           }
        },
 
        init: function(view) {
@@ -50,6 +61,10 @@ Ext.define('PVE.window.ScheduleSimulator', {
        },
     },
 
+    viewModel: {
+       data: { },
+    },
+
     bodyPadding: 10,
     modal: true,
     resizable: false,
@@ -77,6 +92,13 @@ Ext.define('PVE.window.ScheduleSimulator', {
                    reference: 'iterations',
                    fieldLabel: gettext('Iterations'),
                },
+               {
+                   xtype: 'checkbox',
+                   bind: {
+                       value: '{utc}'
+                   },
+                   fieldLabel: gettext('UTC'),
+               },
                {
                    xtype: 'container',
                    layout: 'hbox',
-- 
2.30.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to