You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Vitor Granzinoli Vellozo <vi...@cpmbraxis.com> on 2011/06/21 23:16:09 UTC

Strange problem with DateTextField

 

Wicketers,

 

I found a problem with DateTextField, when a date comes like 11/10/2010
(dd/MM/yyyy) to be showed at

a page, and it shows 10/10/2010, it shows a date decreased. The same
ocurrs if the date is 12/10/2010.

 

It ocurrs with dates near 10/10/2010. I also fixed dates manually and it
doesn't change, it's very strange

and I need you help.

 

Below, the code:

 

DateTextField dateTF = new DateTextField("finalDate", new
PropertyModel(someObject.getFinalDate(), "finalDate"), new
PatternDateConverter("dd/MM/yyyy", true));

dateTF.add(new DatePicker());

add(dateTF);

 

 

Some idea about?

 

Thanks a lot

Vitor

 


Re: Strange problem with DateTextField

Posted by Peter Ertl <pe...@gmx.org>.
Hi Vitor,

I could not reproduce your problem. Try the following things...

- change the boolean in PatternDateConverter to 'false' to not respect the client time zone. does this change the faulty behavior?
- what locale are you using in your application? try 'log.info("locale = " + Session.get().getLocale())' to see the current value used for date conversion
- does the behavior depend on the browser? try firefox, chrome, ie, etc. to check this



Am 21.06.2011 um 23:16 schrieb Vitor Granzinoli Vellozo:

> 
> 
> Wicketers,
> 
> 
> 
> I found a problem with DateTextField, when a date comes like 11/10/2010
> (dd/MM/yyyy) to be showed at
> 
> a page, and it shows 10/10/2010, it shows a date decreased. The same
> ocurrs if the date is 12/10/2010.
> 
> 
> 
> It ocurrs with dates near 10/10/2010. I also fixed dates manually and it
> doesn't change, it's very strange
> 
> and I need you help.
> 
> 
> 
> Below, the code:
> 
> 
> 
> DateTextField dateTF = new DateTextField("finalDate", new
> PropertyModel(someObject.getFinalDate(), "finalDate"), new
> PatternDateConverter("dd/MM/yyyy", true));
> 
> dateTF.add(new DatePicker());
> 
> add(dateTF);
> 
> 
> 
> 
> 
> Some idea about?
> 
> 
> 
> Thanks a lot
> 
> Vitor
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RES: Strange problem with DateTextField

Posted by Vitor Granzinoli Vellozo <vi...@cpmbraxis.com>.
Noven,

First, thanks a lot for the help.

I notice that we were using org.apache.wicket.datetime.markup.html.form.DateTextField, not the other one
org.apache.wicket.extensions.markup.html.form.DateTextField.

We changed it, and the problem persisted.

So, we did another change, we removed the usage of PatterDateConverter, and the problem disappeared, but now,
our year has 2 digits, not 4 like we need.

Observing your piece of code, we noticed that the pattern is in the model constructor, so we did it and the
problem disapeared totally.

Below, our code:

DateTextField finalDate = new DateTextField("finalDate", new PropertyModel<Date>(finalDate, "finalDate"), "dd/MM/yyyy");
finalDate.add(new DatePicker());
add(finalDate);

So, some strange behavior happens with PatternDateConverter, that I really do not know.
Or, this component must not be used like we did.


Thanks all,
Vitor



-----Mensagem original-----
De: Noven [mailto:noven_lie@yahoo.com] 
Enviada em: quarta-feira, 22 de junho de 2011 02:19
Para: users@wicket.apache.org
Assunto: Re: Strange problem with DateTextField

Vitor,

There are 2 DateTextField I know for wicket, org.apache.wicket.datetime.markup.html.form.DateTextFieldand org.apache.wicket.extensions.markup.html.form.DateTextField.
I used many DateTextField from wicket extensions in my project. It works fine. 
The code is almost the same with the one you use, 

DateTextField dateTF  = new DateTextField("finalDate", new PropertyModel(someObject.getFinalDate(), "dd/MM/yy");

You can get the extentions class from maven by add below code to your project dependencies. 

<dependency>
            <groupId>org.apache.wicket</groupId>
            <artifactId>wicket-extensions</artifactId>
            <version>${wicket.version}</version>
        </dependency>

If you haven't solved your problem, you can try this. 

I hope this will help you.

Regards,
Noven



________________________________
From: Vitor Granzinoli Vellozo <vi...@cpmbraxis.com>
To: users@wicket.apache.org
Sent: Wednesday, June 22, 2011 4:16 AM
Subject: Strange problem with DateTextField



Wicketers,



I found a problem with DateTextField, when a date comes like 11/10/2010
(dd/MM/yyyy) to be showed at

a page, and it shows 10/10/2010, it shows a date decreased. The same
ocurrs if the date is 12/10/2010.



It ocurrs with dates near 10/10/2010. I also fixed dates manually and it
doesn't change, it's very strange

and I need you help.



Below, the code:



DateTextField dateTF = new DateTextField("finalDate", new
PropertyModel(someObject.getFinalDate(), "finalDate"), new
PatternDateConverter("dd/MM/yyyy", true));

dateTF.add(new DatePicker());

add(dateTF);





Some idea about?



Thanks a lot

Vitor

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Strange problem with DateTextField

Posted by Noven <no...@yahoo.com>.
Vitor,

There are 2 DateTextField I know for wicket, org.apache.wicket.datetime.markup.html.form.DateTextFieldand org.apache.wicket.extensions.markup.html.form.DateTextField.
I used many DateTextField from wicket extensions in my project. It works fine. 
The code is almost the same with the one you use, 

DateTextField dateTF  = new DateTextField("finalDate", new PropertyModel(someObject.getFinalDate(), "dd/MM/yy");

You can get the extentions class from maven by add below code to your project dependencies. 

<dependency>
            <groupId>org.apache.wicket</groupId>
            <artifactId>wicket-extensions</artifactId>
            <version>${wicket.version}</version>
        </dependency>

If you haven't solved your problem, you can try this. 

I hope this will help you.

Regards,
Noven



________________________________
From: Vitor Granzinoli Vellozo <vi...@cpmbraxis.com>
To: users@wicket.apache.org
Sent: Wednesday, June 22, 2011 4:16 AM
Subject: Strange problem with DateTextField



Wicketers,



I found a problem with DateTextField, when a date comes like 11/10/2010
(dd/MM/yyyy) to be showed at

a page, and it shows 10/10/2010, it shows a date decreased. The same
ocurrs if the date is 12/10/2010.



It ocurrs with dates near 10/10/2010. I also fixed dates manually and it
doesn't change, it's very strange

and I need you help.



Below, the code:



DateTextField dateTF = new DateTextField("finalDate", new
PropertyModel(someObject.getFinalDate(), "finalDate"), new
PatternDateConverter("dd/MM/yyyy", true));

dateTF.add(new DatePicker());

add(dateTF);





Some idea about?



Thanks a lot

Vitor