calendar: mindate pattern?

UI Components for JSF
Post Reply
rewind87
Posts: 1
Joined: 28 Apr 2010, 10:44

28 Apr 2010, 10:50

Hi,

I am using calendar and mindate.
When I use a java.util.Date, it takes the days instead months and vice versa.

I red the javadoc; if you use String you have to use the pattern "MM/dd/yyyy", but if you use Date, it would take the fields from it in the correct order, I think.

I use this code:

<p:calendar id="calFrom" pattern="dd/MM/yyyy" startWeekday="1"
value="#{advSearchBean.dateFrom}"
onselectUpdate="calUntil"
selectListener="#{advSearchBean.dateSelected}"/>

<p:calendar id="calUntil" pattern="dd/MM/yyyy" startWeekday="1"
value="#{advSearchBean.dateUntil}"
mindate="#{advSearchBean.dateFrom}" />

AdvSearchBean.java
...
import java.util.Date;
...

private Date dateFrom;

...
(getters and setters also)
...

public void dateSelected(DateSelectEvent event) {
dateFrom=event.getDate();
}

...

when I select "1 of April of 2010" (01/04/2010) in calFrom, it saves it in Bean attribute dateFrom and update calUntil, but mindate was "4 of January of 2010" (04/01/2010) instead of "1 of April of 2010" (01/04/2010).

I am doing anything wrong?

Is mindate doing it wrong with Date class?

Thanks a lot.
I hope you can understand me.
PD: I use debug, and first Date is saved correctly to bean with correct atributes.

robegf
Posts: 6
Joined: 09 Apr 2010, 16:09

30 Apr 2010, 08:32

I've the same problem.
Ubuntu 9.1
JSF 2.0 Mojarra
Prime faces Snapshot 2.0.2
Tomcat 6.0.24
FF 3.5

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Baidu [Spider] and 33 guests