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? It also happens during the JSF validation lifecycle; so, for example, if another field on the forms has a validation error, the date input textbox will lose a day.
The timezone in java.util.Date is GMT, and yes it's a royal pain. Especially since there's no way to globally environmentally set the effective time zone for all date/time tags on a JSF page.
Which means that they all are either displayed in GMT or you have to manually set each and every one to the preferred zone. Which could be especially annoying if you have a web application with users in local timezones and want to display relative to their local times.
Science is the process of replacing what we "know" with what is TRUE. Politics, alas, often prefers to be the opposite.
Thanks for the responses, all. So you are thinking it is a timezone issue after all? What about when you set the datePattern on the rich:calendar to not include any time? It shouldn't even keep track of the time or time zone, right? I think it still does, though, as when I just use "dd-mon-yyyy" it always shows "20:00 GMT" for the time.
With that in mind, I can't understand why it would decrease the day - since that would be a big jump in time.
I am doing something similar; although I did not write a converter for java.util.Date, I am using a binding method for <f:convertDateTime> and also using some EL to perform a custom datePattern on <rich:calendar>.
Usually you can set this the timezone in your application server's startup script. I noticed this with my JBoss server when my logs were always 2 hours behind. I'm not sure about the other application servers but with JBoss you can go to %JBOSS_HOME%/bin/run.bat (or run.sh for Linux) and edit the file. Search for 'GMT' and then fix the timezone there.
Be or don't be.
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad: