DatePicker: set maxdate based on first date in range

UI Components for JSF
Post Reply
netslow
Posts: 5
Joined: 14 Jul 2021, 16:17

15 Jul 2021, 17:18

Hello, community!
I have datePicker with selectionMode=range, and I want to set maxdate as: first date in range + month - 1 day.
For example if I select 1 Jan, maxdate should be 31 Jan.
Is it possible?

PF 8.0

iamsteve03
Posts: 1
Joined: 22 Sep 2021, 14:01

22 Sep 2021, 14:06

$("#datepicker").datepicker({ minDate: -0, maxDate: new Date(2013, 1, 18) });
You can try the above code, it helped me. I think it can solve your issue too. If you want to use hard coded date, use the new Date(2013, 1, 18) pattern.

If you want to use a generic pattern, use "+1D +1M +1Y".

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests