[pmg-devel] applied: [PATCH pmg-gui v3] StatTimeSelector: don't show invalid month/day combinations

Stoiko Ivanov s.ivanov at proxmox.com
Tue Oct 4 13:58:27 CEST 2022


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 at 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 at proxmox.com>
> Signed-off-by: Dominik Csapak <d.csapak at 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();
>  	},
>  





More information about the pmg-devel mailing list