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

Calendar: mindate and maxdate does not work #7576

Closed
ghost opened this issue Jul 12, 2021 · 1 comment · Fixed by #7637
Closed

Calendar: mindate and maxdate does not work #7576

ghost opened this issue Jul 12, 2021 · 1 comment · Fixed by #7637
Assignees
Labels
🐞 defect Bug...Something isn't working
Milestone

Comments

@ghost
Copy link

ghost commented Jul 12, 2021

Describe the defect
As described here
https://forum.primefaces.org/viewtopic.php?f=3&t=67214
setting mindate/maxdate in p:calender get strange results.

This one works:
<p:calendar id="cal" mode="inline" value="#{data.selectedDate}" pattern="dd.MM.yyyy" locale="de" mindate="03.06.2021" maxdate="09.06.2021"> <p:ajax event="dateSelect" listener="#{controller.dateSelectListener}" update="controlButtons"/> </p:calendar>

For this dates, I got a error "Calendar : "cal" minimum date must be less than maximum date.":
<p:calendar id="cal" mode="inline" value="#{data.selectedDate}" pattern="dd.MM.yyyy" locale="de" mindate="27.05.2021" maxdate="10.06.2021"> <p:ajax event="dateSelect" listener="#{controller.dateSelectListener}" update="controlButtons"/> </p:calendar>

Reproducer
Just open your showcase
https://www.primefaces.org/showcase/ui/input/calendar/calendar.xhtml
In your showcase mindate="4/1/14" and maxdate="7/1/14". It seems that p:calendar does not use these values.

Environment:

  • PF Version: 10.0.0
  • JSF + version: MyFaces 2.3.9
  • Affected browsers: all

To Reproduce
See "Reproducer" for details.

Expected behavior
mindate and maxdate should work as expected for ALL dates. I can't migrate to datepicker at the moment, which was suggested by another user.

Example XHTML
See "Reproducer" for details.

Example Bean
See "Reproducer" for details.

@ghost ghost added the 🐞 defect Bug...Something isn't working label Jul 12, 2021
@melloware melloware changed the title p:calendar mindate and maxdate does not work Calendar: mindate and maxdate does not work Jul 12, 2021
@wal-jan
Copy link
Contributor

wal-jan commented Jul 26, 2021

DatePicker shows same behaviour

<p:datePicker id="datepicker" mindate="27.05.2021" maxdate="10.06.2021" pattern="dd.MM.yyyy"/>

results in ... minimum date must be less than maximum date

wal-jan added a commit to wal-jan/primefaces that referenced this issue Jul 26, 2021
wal-jan added a commit to wal-jan/primefaces that referenced this issue Jul 26, 2021
@melloware melloware added this to the 11.0.0 milestone Jul 26, 2021
@melloware melloware linked a pull request Jul 26, 2021 that will close this issue
wal-jan added a commit to wal-jan/primefaces that referenced this issue Jul 27, 2021
wal-jan added a commit to wal-jan/primefaces that referenced this issue Jul 27, 2021
wal-jan added a commit to wal-jan/primefaces that referenced this issue Jul 27, 2021
wal-jan added a commit to wal-jan/primefaces that referenced this issue Jul 27, 2021
melloware pushed a commit that referenced this issue Jul 27, 2021
* Fix #7576: corrected validateMinMax used in p:calendar and p:datePicker

* Fix #7576: added momre tests

* Fix #7576: added validateMinMax unit tests

* Fix #7576: corrected validateMinMax used in p:calendar and p:datePicker

* Fix #7576: corrected validateMinMax used in p:calendar and p:datePicker

* Fix #7576: enhanced validateMinMax unit tests

* refactored after review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 defect Bug...Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants