Skip to content

ui5-datepicker: valid flag is still true when input a date value out of the max and min scope #1754

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

Closed
zhangliangyi opened this issue Jun 9, 2020 · 2 comments
Assignees

Comments

@zhangliangyi
Copy link

Hi colleagues,

I am from Experience Web team in SAP Successfactors.

Describe the bug
In datepicker with minDate and maxDate, if user inputs a date value out of the scope defined by keyboard. The valid flag in event.originalEvent.detail is still true while the valueState of the field is switched to Error.

this.fireEvent("change", { value: nextValue, valid: isValid });

To reproduce
Steps to reproduce the behavior:

  1. Go to https://sap.github.io/ui5-webcomponents/playground/components/DatePicker/
  2. Input '1/1/2019' in the date field in the 3rd section

Expected behavior
The valid flag exposed in the change event should be false in this case.

Context

  • UI5 Web Components version: rc7
  • OS/Platform: MacOS
  • Browser (if relevant): Chrome
  • Other information: N/A
@ilhan007
Copy link
Member

ilhan007 commented Jun 9, 2020

Try this URL, pointing to the master:
https://sap.github.io/ui5-webcomponents/master/playground/main/pages/DatePicker/

The valueState is set on change, when the focus moves out of the date picker.
If it is empty value, the valueState should be cleared out.

Should be fixed with:
#1742

@ilhan007 ilhan007 closed this as completed Jun 9, 2020
@ilhan007 ilhan007 self-assigned this Jun 9, 2020
@zhangliangyi
Copy link
Author

@ilhan007
The fix you attached above is just fixing the unnecessary error state in empty value case (also it is reported by me).

In this case, if you type the date value out of the scope between minDate and maxDate, the change event should expose the valid value with false instead of true.

In other word, it may be like this:

this.fireEvent("change", { value: nextValue, valid: isValid && isInValidRange }); 

Then the valid flag would be consistent to the valueState.

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

No branches or pull requests

2 participants