Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PreviousPageEnabled wrong value #1860

Open
rghosn opened this issue Jan 18, 2023 · 0 comments · May be fixed by #1861
Open

PreviousPageEnabled wrong value #1860

rghosn opened this issue Jan 18, 2023 · 0 comments · May be fixed by #1861

Comments

@rghosn
Copy link

rghosn commented Jan 18, 2023

In short words : the previous page is enabled (in some cases) while it shouldn't be

Below one of the cases we faced:
start date : 01-FEB-2023
Calendar is limited between
min date : 01-FEB-2023
max date : 28-FEB-2023
The user can only pick days in FEB (not JAN nor MAR).
The next page button is disabled (which is okay)
The previous page button is enabled (WRONG!!)

Cause:
The issue is due to a bug in CalendarController.js update function where the dates are being compared without taking into consideration the Time :

Line 531 - json.setValue(settings, "minValue", dateUtils.removeTime(settings.minValue));
Line 600 - startDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1, 12);

The last parameter is generating a date at noon and then once compared with the minimum date :

Line 627 - json.setValue(calendar, "previousPageEnabled", !minValue || minValue < startDate);

The result is TRUE whilst it should be FALSE

rghosn added a commit to rghosn/ariatemplates that referenced this issue Jan 18, 2023
As explained in the issue, in some cases, we have the previouspageenabled attribute with a wrong value causing our date picker to show the previous button.
In this fix, I removed the hour parameter in the new Date() constructor, and called removeTime to ensure that the dates are being compared without taking time into consideration.
Also, I added two new test cases to ensure that the changes are working well.

Close ariatemplates#1860
@rghosn rghosn linked a pull request Jan 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant