public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui] StatTimeSelector: don't show invalid month/day combinations
Date: Fri,  1 Jul 2022 09:44:26 +0200	[thread overview]
Message-ID: <20220701074426.1461977-1-d.csapak@proxmox.com> (raw)

by limiting the store of the day selector by the selected month

reported by a user in the forum:
https://forum.proxmox.com/threads/wrong-calendar.111631/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 js/StatTimeSelector.js | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/js/StatTimeSelector.js b/js/StatTimeSelector.js
index f01b058..c570c1e 100644
--- a/js/StatTimeSelector.js
+++ b/js/StatTimeSelector.js
@@ -73,7 +73,25 @@ Ext.define('PMG.StatTimeSelector', {
 	    Ext.GlobalEvents.fireEvent('pmgStatTimeSelectorUpdate', data);
 	},
 
+	updateDays: function() {
+	    let monthsel = this.lookupReference('monthsel');
+	    let daysel = this.lookupReference('daysel');
+	    let month = monthsel.getValue();
+	    let maxDays = 31;
+	    if (month === 2) {
+		maxDays = 28;
+	    } else if (month % 2 === 0) {
+		maxDays = 30;
+	    }
+	    daysel.getStore().setFilters([{
+		property: 'day',
+		operator: '<=',
+		value: maxDays,
+	    }]);
+	},
+
 	onSelect: function() {
+	    this.updateDays();
 	    this.updateVisibility();
 	},
 
-- 
2.30.2





             reply	other threads:[~2022-07-01  7:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01  7:44 Dominik Csapak [this message]
2022-07-01  7:50 ` Dominik Csapak

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=20220701074426.1461977-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pmg-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