public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH manager 5/5] ui: ScheduleSimulator: add UTC checkbox
Date: Wed, 18 Jan 2023 15:35:23 +0100	[thread overview]
Message-ID: <20230118143523.3587956-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20230118143523.3587956-1-d.csapak@proxmox.com>

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.csapak@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





  parent reply	other threads:[~2023-01-18 14:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 14:35 [pve-devel] [PATCH manager 1/5] ui: reduce default size of Backup detail window Dominik Csapak
2023-01-18 14:35 ` [pve-devel] [PATCH manager 2/5] ui: BackupView: add scrolling overflow handler for the toolbar Dominik Csapak
2023-01-19 17:13   ` [pve-devel] applied: " Thomas Lamprecht
2023-01-18 14:35 ` [pve-devel] [PATCH manager 3/5] ui: ScheduleSimulator: split date and time into two columns Dominik Csapak
2023-01-19 17:13   ` [pve-devel] applied: " Thomas Lamprecht
2023-01-18 14:35 ` [pve-devel] [RFC PATCH manager 4/5] ui: ScheduleSimulator: add rownumberer column Dominik Csapak
2023-01-20  9:30   ` Thomas Lamprecht
2023-01-18 14:35 ` Dominik Csapak [this message]
2023-01-19 17:16   ` [pve-devel] [RFC PATCH manager 5/5] ui: ScheduleSimulator: add UTC checkbox Thomas Lamprecht
2023-01-19 17:11 ` [pve-devel] applied: [PATCH manager 1/5] ui: reduce default size of Backup detail window Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230118143523.3587956-5-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal