DatePicker: Validation error "INVALID_RANGE_DATES_SEQUENTIAL" when dates are the same
See original GitHub issueDescribe the bug
If you have a datepicker using selectionMode=“range” and select the same date for the starting date and end date, you get an error saying that the start date is greater than the end date, which is incorrect. I tracked down the issue to this line: https://github.com/primefaces/primefaces/blob/master/primefaces/src/main/java/org/primefaces/component/datepicker/DatePicker.java#L178
I changed it in my local copy of primefaces from:
if (isValid() && startDate.compareTo(endDate) > -1) {
setValid(false);
validationResult = ValidationResult.INVALID_RANGE_DATES_SEQUENTIAL;
}
to:
if (isValid() && startDate.compareTo(endDate) > 0) {
setValid(false);
validationResult = ValidationResult.INVALID_RANGE_DATES_SEQUENTIAL;
}
Which fixed the issue
Reproducer
No response
Expected behavior
No validation error should occur when the dates are the same.
PrimeFaces edition
Community
PrimeFaces version
12.0.0-RC3
Theme
No response
JSF implementation
All
JSF version
Any
Java version
Any
Browser(s)
Any
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Angular Material Datepicker validation error #23097 - GitHub
It seems like it only checks the same date that caused the error, rather than checking both dates for an update in the...
Read more >Angular 5, Angular Material: Datepicker validation not working
I use ErrorStateMatcher in my Angular Material Forms, it works perfectly. You should have a code that looks like that:
Read more >DatePicker.DateValidationError Event - Microsoft Learn
The following example creates a DatePicker that displays the dates in August 2009 and specifies that each Saturday and Sunday is not selectable....
Read more >Date Picker Plugin Causes field validation errors
Has anyone else noticed that using the Datepicker plugin causes the form not to send because of “validation issues” even without any required...
Read more >DatePicker - Mantine
Capture date or dates range from user. ... DateRangePicker component (supports the same props as DatePicker ... Error as boolean – red border...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
PR Submitted letting the integration tests run now
Also as I said above I chose the same exact month for both the start and end date so those values there on the debugger are correct.