* [pmg-devel] [PATCH pmg-gui v3] StatTimeSelector: don't show invalid month/day combinations
@ 2022-07-01 11:42 Dominik Csapak
2022-10-04 11:58 ` [pmg-devel] applied: " Stoiko Ivanov
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2022-07-01 11:42 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/
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v2:
* got rid of unnecessary intermed. variables
* lookup instead of lookupReference
* shorter (one line) comment
* change function name to updateMaxDays
js/StatTimeSelector.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/js/StatTimeSelector.js b/js/StatTimeSelector.js
index f01b058..81958eb 100644
--- a/js/StatTimeSelector.js
+++ b/js/StatTimeSelector.js
@@ -73,7 +73,20 @@ Ext.define('PMG.StatTimeSelector', {
Ext.GlobalEvents.fireEvent('pmgStatTimeSelectorUpdate', data);
},
+ updateMaxDays: function() {
+ let year = this.lookup('yearsel').getValue();
+ let month = this.lookup('monthsel').getValue();
+ // get last day of current month by wrapping back day 0 from next (zero indexed) month
+ let maxDays = new Date(year, month, 0).getDate();
+ this.lookup('daysel').getStore().setFilters([{
+ property: 'day',
+ operator: '<=',
+ value: maxDays,
+ }]);
+ },
+
onSelect: function() {
+ this.updateMaxDays();
this.updateVisibility();
},
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pmg-devel] applied: [PATCH pmg-gui v3] StatTimeSelector: don't show invalid month/day combinations
2022-07-01 11:42 [pmg-devel] [PATCH pmg-gui v3] StatTimeSelector: don't show invalid month/day combinations Dominik Csapak
@ 2022-10-04 11:58 ` Stoiko Ivanov
0 siblings, 0 replies; 2+ messages in thread
From: Stoiko Ivanov @ 2022-10-04 11:58 UTC (permalink / raw)
To: Dominik Csapak; +Cc: pmg-devel
Sorry for overlooking this one - gave it a quick spin and applied it.
Huge Thanks!
On Fri, 1 Jul 2022 13:42:00 +0200
Dominik Csapak <d.csapak@proxmox.com> wrote:
> 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/
>
> Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> changes from v2:
> * got rid of unnecessary intermed. variables
> * lookup instead of lookupReference
> * shorter (one line) comment
> * change function name to updateMaxDays
> js/StatTimeSelector.js | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/js/StatTimeSelector.js b/js/StatTimeSelector.js
> index f01b058..81958eb 100644
> --- a/js/StatTimeSelector.js
> +++ b/js/StatTimeSelector.js
> @@ -73,7 +73,20 @@ Ext.define('PMG.StatTimeSelector', {
> Ext.GlobalEvents.fireEvent('pmgStatTimeSelectorUpdate', data);
> },
>
> + updateMaxDays: function() {
> + let year = this.lookup('yearsel').getValue();
> + let month = this.lookup('monthsel').getValue();
> + // get last day of current month by wrapping back day 0 from next (zero indexed) month
> + let maxDays = new Date(year, month, 0).getDate();
> + this.lookup('daysel').getStore().setFilters([{
> + property: 'day',
> + operator: '<=',
> + value: maxDays,
> + }]);
> + },
> +
> onSelect: function() {
> + this.updateMaxDays();
> this.updateVisibility();
> },
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-04 11:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 11:42 [pmg-devel] [PATCH pmg-gui v3] StatTimeSelector: don't show invalid month/day combinations Dominik Csapak
2022-10-04 11:58 ` [pmg-devel] applied: " Stoiko Ivanov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal