I am writing a JSF 2.0 Mojarra application using Primefaces 3.3.1 on Tomcat 6. Using the PrimeFaces <p:calendar> component, I need to disable future dates. I realize that I must set the maxdate attribute to the current date. However, I am not sure what the easiest way is to accomplish this.
I realize that I could create a Managed Bean of java.util.Date, but this is an international application, and I need to account for the location of the user. If the user is on the other side of the world, the server date could be incorrect for him.
So, what is the easiest way to retrieve the current date at the user’s location, and set the <p:calendar> maxdate attribute equal to that value? A completely client-side solution would be ideal, if that is possible.
You can get the client system date.
<p:calendar>calendar is an jquery-ui widget, you can have client acess on it by defining widgetVar and set the maxdate using javascript.