Update seconds in calendar based on maxdate

UI Components for JSF
Post Reply
sathish462
Posts: 9
Joined: 05 Sep 2012, 11:10

21 Nov 2017, 16:54

Primefaces Verison :3.5

Problem with calendar component limit based on maxdate.
pattern is added along with time
pattern="dd/MM/yyyy HH:mm:ss"

calendar component A:
Selected date : 30/11/2017 11:12:16

Calendar component B :
With maxdate = "calendar component A.value"

I select the previous day and set the hour ----> 23 and minutes ---->59 and seconds ----> 59
If i select the exact date in "calendar component A" then the hours and minutes are limited based on "component A" but not the seconds .

Does anyone know what needs to be done ? :?: :?:

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

21 Nov 2017, 21:28

You need a p:ajax on calendar a with an update="calendarB".

Similar to this where one selectOne updates another one: https://www.primefaces.org/showcase/ui/ ... down.xhtml
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

sathish462
Posts: 9
Joined: 05 Sep 2012, 11:10

22 Nov 2017, 10:25

Melloware wrote:
21 Nov 2017, 21:28
You need a p:ajax on calendar a with an update="calendarB".

Similar to this where one selectOne updates another one: https://www.primefaces.org/showcase/ui/ ... down.xhtml
Thanks for the reply ;)

But, the date along with hours and seconds are updated accordingly . its only the seconds which is not changed.! (once after i try to change the Seconds there applies the limitation)
On adding ajax to update calendarB closes the datePicker on each and every date or time selection :roll:

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

22 Nov 2017, 14:20

Ahh I think I understand now more what you want and I think you will have to do what you want entirely with Javascript all on the client side. The Calendar widgets have JS API for reading the date from one and setting the data of another by its WidgetVar.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

sathish462
Posts: 9
Joined: 05 Sep 2012, 11:10

22 Nov 2017, 17:04

Melloware wrote:
22 Nov 2017, 14:20
Ahh I think I understand now more what you want and I think you will have to do what you want entirely with Javascript all on the client side. The Calendar widgets have JS API for reading the date from one and setting the data of another by its WidgetVar.
Ha ok , thats how i solved it. :lol:
But just curious to know any precised solution already available from Primefaces.

Thanks :)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 41 guests