1 Reply Latest reply on Sep 24, 2008 3:48 PM by Tomasz Wilczynski

    Problem with Date subtracting one day

    Chris Simons Expert


      Has anyone experienced an issue wherein a date that is submitted with a datePattern of DD-MON-YYYY reverts to the previous day when modifying using a rich:calendar?

      For example, I have a rich:calendar wherein a date is inputted on a JSF/Seam 2.0GA form.  The date submits appropriately.  When I then edit this date, the rich:calendar and inputText think the date is now one day prior to the previously entered date.  This problem persists...so if I submit the form with the new date (-1) and repeat the process, I will lose one day each time.

      I'm starting to suspect this has to do with the timezone of the time (since there is no time in the datePattern)?  Has anyone experienced this before?

      I am also using a custom convertDateTime binding, which is split out by convertDate and convertDateTime.

      Like so:

      public void setConvertDate(DateTimeConverter convertDate)
               Locale defaultLocale = Locale.US;
               TimeZone defaultTimeZone = TimeZone.getTimeZone("GMT");
               convertDate.setLocale(defaultLocale );
               if (log.isDebugEnabled())
                    log.debug("Set convertDate with " + convertDate.getPattern());