Announcement

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

    Calendar Widget uses Local Timezone

    I'm using the released SmartGWT 2.5.

    It appears the Calendar widget displays times in Local time. The SmartGWT server code is returning dates in UTC, but the calendar is showing those dates with the local timezone adjustment. I have set the client to

    Code:
     DateUtil.setDefaultDisplayTimezone("+0:00");
     DateUtil.setAdjustForDST(false);
    but this seems to have no effect on the Calendar. My ListGrid datetimes are all fine.

    #2
    Hi Atomatom,
    We'll be resolving this issue in the framework as part of our next bug-fix release - we'll let you know when the fix makes it into the code base (so becomes available in nightly builds).

    Regards
    Isomorphic Software

    Comment


      #3
      Great, thank you.

      Comment


        #4
        Is the above fix applied to any of latest nightly builds?

        Comment


          #5
          This should already be resolved to nightly builds, yes
          Please let us know if you aren't seeing it

          Thanks
          Isomorphic Software

          Comment


            #6
            We tried the 2011 November 1st Smartgwt LGPL nightly build. But Still no success.

            Comment


              #7
              That's odd. Can you show us a test case so we can try out your usage?

              - Not sure how your data is being loaded by the way but if you're using an XML or JSON dataSource, you should be able to show us a response snapshot as a static file along with the ds definition -- no need for any server side logic

              Comment


                #8
                This is still busted for me using the Pro version as well. Using a JPA2DataSource, though I'm not clear that has any bearing on it.

                I presume you meant the 2.5 nightly?

                Making a test case simply involves setting the Display time zone as above, an creating an event in a datasource, and showing the same datasource in both a Calendar and ListGrid.

                Here is the raw result from the RPC call:

                Code:
                [
                    {
                        endRow:1, 
                        queueStatus:0, 
                        totalRows:1, 
                        isDSResponse:true, 
                        invalidateCache:false, 
                        status:0, 
                        startRow:0, 
                        data:[
                            {
                                available:null, 
                                canEdit:null, 
                                date:new Date(1325793600000), 
                                description:"", 
                                endDate:new Date(1325757600000), 
                                endTime:new Date(-21600000), 
                                eventId:41, 
                                eventWindowStyle:null, 
                                locked:null, 
                                name:"", 
                                startDate:new Date(1325754000000), 
                                startTime:new Date(-25200000), 
                            }
                        ]
                    }
                ]
                This event appears at 1am on the Calendar timeline (eg, on the 3rd row of the Calendar widget). The Title of the event shows 9:00am. The listgrid shows 9:00am. (The time should be 9:00am).

                Comment


                  #9
                  * using the Pro build of 2.5 from Dec 15th of this month.

                  Comment


                    #10
                    Is this considered an 'anecdotal' test case, or if this is enough for you to go on to create a fix for this?

                    Comment


                      #11
                      Is this still a problem?

                      I am using the call DateUtil.setDefaultDisplayTimezone to set the timezone as defined for the logged in user but the Calendar widget still shows dates in the browser timezone.

                      This is with 4.1p level of code.

                      Comment


                        #12
                        Still reproducible on v9.1p_2014-06-22/LGPL

                        I guess I hit this issue in last SmartGWT 4.1p nightly build, SmartClient Version: v9.1p_2014-06-22/LGPL Development Only (built 2014-06-22)
                        In fact using the databound calendar example with eventData contents replaced with the following snippet, in my browser using a CEST timezone I can see the event placed at 2 am, and not at midnight, while event.toJSON() shows midnight time (UTC), i.e. 2014-06-22T00:00:00.000Z.
                        I could be wrong, cause It's quite easy to underestimate the effects of instantiating a date in JS, but I've seen that sending a timestamp without timezone from some server-side logic produces the same effect (i.e. an event translated of the same amount of time).
                        Code:
                        Time.setDefaultDisplayTimezone ("00:00"); //use UTC as timezone
                        Time.adjustForDST = false; //no DST adjustments
                        
                        var _today = new Date;
                        var _start = _today.getDate() - _today.getDay();
                        var _month = _today.getMonth();
                        var _year = _today.getFullYear();
                        
                        var eventStart = new Date(Date.UTC(_year,_month,_start))
                        var eventEnd = new Date(Date.UTC(_year,_month,_start+1))
                        
                        isc.say (eventStart.toJSON()); //show start date in UTC
                        var eventData = [
                        {
                            eventId: 1, 
                            name: "Meeting",
                            description: "Shareholders meeting: monthly forecast report",
                            startDate: eventStart,
                            endDate: eventEnd
                        }
                        ];
                        From the following screenshot you can see how the event is placed at 2 am, the actual event start is shown into the popup message dialog (at UTC midnight) and on the bottom right corner you can see the browser Sources tab with a watch expression showing the timezone offset for the browser default locale.



                        IMHO this shows how the calendar ignores the Time.setDefaultDisplayTimezone ("00:00") directive.
                        Attached Files
                        Last edited by d.cavestro; 23 Jun 2014, 05:20.

                        Comment


                          #13
                          Isomorphic? Just a remind (no hurry). Since I think in my previous post I've demonstrated how this issue is still reproducible on latest nightly builds, please simply tell me if I'm wrong.

                          Comment

                          Working...
                          X