[pve-devel] applied: [pmg-devel] [PATCH widget-toolkit] datetimefield: fix changing date to end of month from short months

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Feb 27 14:34:29 CET 2024


Am 27/02/2024 um 14:23 schrieb Dominik Csapak:
> When selecting a new date, we get a date object from the currently
> selected date before the change. If that month has less days than what
> was selected for the new month, `setDate` will wrap that to the
> following month since the old month is still selected there.
> 
> For example:
> 
> select any date in april (has 30 days)
> then select the 31th of january
> 
> this will actually select the 1st of january since we first get
> 
> setDate: 20xx-04-XX -> 20xx-04-31 (wrap) -> 20xx-05-01
> setMonth: 20xx-05-01 -> 20xx-01-01
> 
> To fix this, use the additional parameters of setFullYear[0] to set
> all of them simultaneously
> 
> 0: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setFullYear
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/form/DateTimeField.js | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
>

applied, thanks!




More information about the pve-devel mailing list