I have a DateTextField to which I am adding a DatePicker.  The Display works
fine: if I select 4/1/2009 using the DatePicker and I save the form data to
my database, then populate the form again from values in the database, I am
seeing 4/1/2009.

But when I look at my database I see that the stored date is actually
3/31/2009 23:00:00, which is 1 hour before 4/1/2009.

This does not seem to be a Locale issue (that I can tell), as I am running
everything on my local machine.  Also, the odd thing is that when I select
4/1/2009 through 4/5/2009 I get a date stored in my database which is 1 hour
before the selected date.  But when I select anything from 4/6/2009 through
4/30/2009 the date is stored correctly.

I added log statements when the info is loaded from the database and before
it is persisted, and the issue is within the web application.  When I print
the dates before persisting them to the database they are wrong by 1 hour,
for 4/1/2009 through 4/5/2009.

I had the same issue with yui.DateField, but I'm not sure if this is a YUI
DatePicker issue or something else I am not considering or doing correctly.

Here's a snippet of my code:

    DateTextField appointmentPickerTextField = new
DateTextField("dayOfYear", new PropertyModel(appointment, "dayOfYear"), new
StyleDateConverter(false)) {
      @Override
      public boolean isVisible() {
        return appointment.getScheduledDate() != null;
      }
    };
    appointmentPickerTextField .setRequired(true);
    appointmentPickerTextField .add(new DatePicker());

Any thoughts?

Reply via email to