public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-gui] StatTimeSelector: don't show invalid month/day combinations
@ 2022-07-01  7:44 Dominik Csapak
  2022-07-01  7:50 ` Dominik Csapak
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2022-07-01  7:44 UTC (permalink / raw)
  To: pmg-devel

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pmg-devel] [PATCH pmg-gui] StatTimeSelector: don't show invalid month/day combinations
  2022-07-01  7:44 [pmg-devel] [PATCH pmg-gui] StatTimeSelector: don't show invalid month/day combinations Dominik Csapak
@ 2022-07-01  7:50 ` Dominik Csapak
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Csapak @ 2022-07-01  7:50 UTC (permalink / raw)
  To: pmg-devel

disregard this.. did not have enough sleep/coffee obviously ^^




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-01  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01  7:44 [pmg-devel] [PATCH pmg-gui] StatTimeSelector: don't show invalid month/day combinations Dominik Csapak
2022-07-01  7:50 ` Dominik Csapak

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