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

    Problem with Date subtracting one day

    Chris Simons Expert

      All,


      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.setPattern(this.getEnglinkProp("output.datePattern"));
               convertDate.setDateStyle(this.getEnglinkProp("output.dateStyle"));
               convertDate.setLocale(defaultLocale );
               convertDate.setDateStyle(this.getEnglinkProp("output.dateStyle"));
               convertDate.setType("date");
               convertDate.setTimeZone(defaultTimeZone);
               
               if (log.isDebugEnabled())
                    log.debug("Set convertDate with " + convertDate.getPattern());
               
          }