PDA

View Full Version : DatePicker in DateField returns one day less than selected



Carlos Ijelchuk
24 Aug 2009, 6:38 AM
Hi all!!

I think this is a BUG, anyone knows a workaround?

when I click on a date, for example "Aug 28" in the corresponding field i'm getting "Aug 27", allways the same with Date Fields and DateTime Fields, I've also tryed to use differents DateTimeFormat.

my code:



final DateField Fecha = new DateField();
Fecha.setFormatValue(true);
Fecha.getPropertyEditor().setFormat(DateTimeFormat.getMediumDateFormat());
Fecha.setFieldLabel("Fecha");
appForm.add(Fecha);

final TimeField Inicio = new TimeField();
Inicio.setFieldLabel("Inicio");
appForm.add(Inicio);

final TimeField Fin = new TimeField();
Fin.setFieldLabel("Fin");
appForm.add(Fin);

when I try to read the value with this code:


Date FechaInicio = Fecha.getValue();

I get the previous date than seleted.

All suggestions are welcome!

Carlos:-?

sven
24 Aug 2009, 6:43 AM
It works without any problems with your sample for me. Also if this is really an issue many more people would have discovered it.

Arno.Nyhm
24 Aug 2009, 6:52 AM
maybe it depends something on the timezones?

Carlos Ijelchuk
24 Aug 2009, 7:19 AM
I'm using TimeZone -3 GMT for Buenos Aires (Argentina), is that the problem? how can I solve it?

thanks in advance for your help.

Carlos

sven
24 Aug 2009, 7:29 AM
Also works without any problems with that locale for me

Carlos Ijelchuk
24 Aug 2009, 7:29 AM
Sven and Arno.Nyhm, I found out what the problem is.. the problem occurs only with the Hosted Mode, after compiling and test the feature on a regular browser (chrome, FireFox and IE) i've see the problem.

thanks again for your help!

Carlos

user001
24 Feb 2011, 7:02 AM
I have issue like this. When user select some date in DateField with DatePicker, for example 10 Aug 2011 then method DateField.getValue() return 09 Aug 2011 22:00:00, ie it subtracts from the date timezone of user (UTC+2 in this example).

tcozien
8 Mar 2011, 1:59 AM
Hi,

I have the same issue. I don't know how to fix it...
It appears only on certain dates (ie 20/02/1932 -> 19/02/1932 whereas 20/02/1998 -> 20/02/1998)

Any help?

franciscotbjr
27 Oct 2011, 3:32 AM
I've found that this issue is due to windows (in my case) self adjustment to daylight saving time (horário de verão in portuguese) witch here in Brazil represents one hour ahead. If we turn off windows self adjustment to daylight saving, than it works again.

The question is I have just found it and I am still working in a solution.

franciscotbjr
27 Oct 2011, 4:54 AM
The solution is here: http://gwt-ext.com/forum/viewtopic.php?f=8&t=3479

aus_gwit
25 Feb 2013, 4:35 AM
The link above doesn' work anymore.
Does anyone have a solution for Daylight Saving which causes one day offset?
On serverside we use hibernate and automatic binding on client side.
Thank in advance

kostepanych
15 Jul 2013, 7:05 AM
+1
Also have the same problem...
What is the solution?

kostepanych
8 Aug 2013, 6:57 AM
is there anybody alive?

jotablack
25 Oct 2013, 6:27 PM
I needed only to extend datefield and adjust difference caused by config of time zone.

Its temporary. I waiting for complete solution to work with any time zone.


public class DateField extends com.sencha.gxt.widget.core.client.form.DateField
{
public DateField()
{
super();
}

public java.util.Date getValue()
{
if(super.getValue() == null)
return null;
else
return new java.util.Date(super.getValue().getTime() + 43200000);
}
}