[pmg-devel] [PATCH pmg-gui] StatTimeSelector: don't show invalid month/day combinations
Dominik Csapak
d.csapak at proxmox.com
Fri Jul 1 09:44:26 CEST 2022
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 at 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
More information about the pmg-devel
mailing list