public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] applied: [PATCH pmg-gui v3] StatTimeSelector: don't show invalid month/day combinations
Date: Tue, 4 Oct 2022 13:58:27 +0200	[thread overview]
Message-ID: <20221004135827.00bb7e5b@rosa.proxmox.com> (raw)
In-Reply-To: <20220701114200.2984712-1-d.csapak@proxmox.com>

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();
>  	},
>  





      reply	other threads:[~2022-10-04 11:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 11:42 [pmg-devel] " Dominik Csapak
2022-10-04 11:58 ` Stoiko Ivanov [this message]

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=20221004135827.00bb7e5b@rosa.proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=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