Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Weird issue: Date values off by 1 day in ListGrid

    I'm encountering an odd issue in an editable ListGrid whereby when I pull data down from the database, the date columns for entries are always reduced by a single day (for example 3/15/2010 becomes 3/14/2010 in the ListGrid).

    When I print the date out on the server end it's correct, but by the time my client displays it, it's off. The really odd thing is that it doesn't seem to be happening on my personal machine, only on the server. This doesn't appear to be an issue with SmartGWT nor does it appear to be an issue with my database back end, but somehow it's getting screwed up on the display end. This appears to be regardless of the browser I use.

    Another odd thing is that if I edit the grid and save the changes, it's sending the proper values to the server for saving. However if I refresh the page it shows a day earlier (even though the database reflects the proper date).

    Any ideas at all? This one has me stumped.

    #2
    If this is with SmartGWT Pro/EE, be sure the field is declared as type "date" in your server-side DataSource. This does the right thing.

    Otherwise, you'll need to carefully think through the timezones of each involved system (db, server, client) and how the data is being transferred.

    Comment


      #3
      Wow, thanks for the prompt reply.

      I've been using SmartGWT 1.2 and recently tried 2.1 to see if it would make a difference (it didn't). I am located in Houston and the data center resides in Dallas (same time zone). I'm returning a POJO from the server and converting it to a ListGridRecord for display. Might something be going wrong during the conversion?

      Comment


        #4
        Yes. Since you're not using Pro/EE (where this problem is neatly solved), you'll need to carefully think through the timezones of each involved system (db, server, client) and how the data is being transferred.

        Comment


          #5
          I experience the same issue, but on my local machine. Jetty web server, Firefox 3.6.8, MySQL database. The data sent in XML format from the server is correct, according to Firebug, though it's coming through as a DateTime despite the fact that the DS is defined as type Date. I went in and changed my Java class definition from "Date" to "java.sql.Date" and this resolved the issue.

          This is posted in case anyone else runs across this issue.

          Comment

          Working...
          X