Announcement

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

    DateItem - getValueAsDate gets wrong date

    Hi. I've encountered a weird error while I was getting Date from DateItem.
    When I set date to 1982-11-01 or greater everything works as expected. But when I set lower date for instance 1982-10-31 and then I call dateItem.getValueAsDate() I get 1982-10-30. It happens everytime I set the date to lower than 1982-11-01 - one hour is being subtracted from date, so when I set 1982-10-31 00:00, I get 1982-10-30 23:00. Any idea what's going on?
    I've tried many night builds of smartgwt but the problem keeps repeating in every one of them
    Last edited by mtus; 26 Dec 2010, 21:35.

    #2
    I presume you live one hour off GMT. That kind of bug is the date being parsed using the wrong timezone locale. Is this bug seen when you run it locally or is it only when you are using it on a server - and is that server different than your timezone?

    Comment


      #3
      Application is still in development so client and server are on the same machine. I do understand that there might be some issues with timezone, but I would expect that the same amount of time is being subtracted from every date, not only those that are lower than 1982-11-01.

      Comment


        #4
        I have the same problem with DateItem component.

        For example, you selected 14/02/2012, but in DMI log (in a request) we have TO_DATE('2012-02-13 23:00:00','YYYY-MM-DD HH24:MI:SS'). It was on Tomacat.

        From Jetty:
        I selected 15/02/2012 and had that DMI log (in a request): TO_DATE('2012-02-15 04:30:00','YYYY-MM-DD HH24:MI:SS').

        I'm on UTC +3:00, but who cares!

        How to get exactly "clear" date like '2012-02-15 00:00:00' ?

        Comment


          #5
          I will answer myself.

          DO NOT USE "datetime" type for DateItem or for DateTimeItem if you don't need the time part.

          Set type="date" for a field in DataSource and you will have just date with zero time part (00:00:00).

          Also your date won't jump back or forward because of possible time corrections.

          Comment

          Working...
          X