Calendar and internationnal

UI Components for JSF
Post Reply
LaChamelle
Posts: 11
Joined: 02 Dec 2010, 19:38

09 Mar 2011, 18:23

Hello,

I'm working on a JSF 2.0 project using Mojarra 2.0.4-b03, PrimeFaces 2.2.1 and Tomcat 6.29.

I use the calendar like this

Code: Select all

<p:calendar value="#{boxItem.agendaDate}" mode="inline" showOtherMonths="true" styleClass="agendaHBox"
									selectListener="#{boxItem.handleAgendaDateChange}" onSelectUpdate="@form"/>
The boxItem.agendaDate is type of java.util.Date and initialized to the current date (just new Date()).
In my view i set the locale

Code: Select all

<f:view locale="#{wagent.socleAgent.siteLanguage.id}">
When the locale is in English, the day, month year are good. (Display 9th march 2011)
But when i choose other locale (French or spannish) , he show (3th September 2011).

What's wrong on my code and how can I fix it?

User avatar
ydarcin
Posts: 258
Joined: 04 Jan 2009, 19:02
Location: Turkey

11 Mar 2011, 20:08

Hi,

can you test with locale property of p:calendar?

Yigit

LaChamelle
Posts: 11
Joined: 02 Dec 2010, 19:38

16 Mar 2011, 12:03

Hello,

Sorry for the late, i didn't see i get a response.
The problem is when i add the selectListener !

You can easily reproduce with the following code:

Code: Select all

<p:calendar mode="inline" showOtherMonths="true" onSelectUpdate="@form" locale="fr" selectListener="#{bean.handleAgendaDateChange}"/>

Code: Select all

public void handleAgendaDateChange(DateSelectEvent event)
{
	System.out.println("handleAgendaDateChange = " + event);
	System.out.println("date selectionné = " + event.getDate());
}
- I can report the bug on the bugtracker?

- How i can pass over the problem during the time is not fixed?


Thanks you.

User avatar
ydarcin
Posts: 258
Joined: 04 Jan 2009, 19:02
Location: Turkey

16 Mar 2011, 16:14

Hi,

what is your problem actually? i18n the calendar or the selectListener is not invoked?

Yigit

LaChamelle
Posts: 11
Joined: 02 Dec 2010, 19:38

16 Mar 2011, 16:31

The problem is when my locale is different of English and i use the attribute selectListener.

For example if the locale is spannish.
When the calendar appears is at the current date: March 2011 16th.
When I click on an other day like 17th march 2011, the selectListener method is call but the date I received is "Thu May 03 00:00:00 CEST 2012"
and the agenda suddenly change on March 2012 5th.

The selectListener method is :

Code: Select all

public void handleAgendaDateChange(DateSelectEvent event)
{
	System.err.println("handleAgendaDateChange = " + event.getDate());
}
If i remove the selectListener attribute the calendar had the good behavior(stay on March 2011 and select the 17th) but indeed i can't handle the date change.

LaChamelle
Posts: 11
Joined: 02 Dec 2010, 19:38

22 Mar 2011, 11:46

Hello,

I need to handle when user select a date on the calendar and do an ajax request. How I can do that without the selectListener ?

Thanks for ideas.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 54 guests