Announcement

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

    Timelane one day

    Why am I seeing the event from 16.08.16 00:00:01 to 16.08.16 23:59:59 only in the second half of the day 16.08 ?
    Using smartgwt 6.0p power 13.08.16

    Code:
    public void onModuleLoad() {
    
            VLayout vlayout = new VLayout();
            final Timeline calendar = new Timeline();
            calendar.setHeight(451);
            calendar.setCanEditLane(true);
            calendar.setShowEventDescriptions(false);
            
            calendar.setDisableWeekends(false);
            calendar.setDataSource("testTimelane");
            calendar.setStartDateField("f_startDate");
            calendar.setEndDateField("f_endDate");
            calendar.setAutoFetchData(true);
    
            HeaderLevel[] headerLevels = new HeaderLevel[] { new HeaderLevel(TimeUnit.WEEK),
                    new HeaderLevel(TimeUnit.DAY) };
            calendar.setHeaderLevels(headerLevels);
            calendar.setLaneFields(new ListGridField[] { new ListGridField("title", "Developer", 120) });
            calendar.setLanes(TimelineLaneData.getRecords());
            //calendar.setData(TimelineData.getRecords());
    
            vlayout.addMember(calendar);
    
            IButton removeBtn = new IButton("Remove first lane");
    
            removeBtn.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
                    calendar.removeLane(calendar.getLanes()[0]);
                }
            });
            vlayout.setWidth100();
            vlayout.setHeight100();
            vlayout.addMember(removeBtn);
            vlayout.draw();
        }
    Click image for larger version

Name:	Bildschirmfoto 2016-08-16 um 12.00.06.png
Views:	88
Size:	16.8 KB
ID:	239696
    Click image for larger version

Name:	Bildschirmfoto 2016-08-16 um 12.00.17.png
Views:	73
Size:	55.3 KB
ID:	239697

    #2
    Whan dragging the event, I see that this only happens in the first and the last day. In all other days, the event spans the whole day.

    Comment


      #3
      Isomorphic were you able to reproduce the issue?

      Comment


        #4
        We're taking a look today - your values in your table are in UTC (no timezone specified) - what timezone is your browser in?

        Comment


          #5
          When I write: javascript:Date() I get:
          Thu Aug 18 2016 13:42:13 GMT+0200 (CEST)

          Maybe the issue I sent you per email regarding 2 hours shift is related?
          Should I post this issue here for better reference ?

          Comment


            #6
            Your server/DB are presumably also in GMT+2 - so when you create dates as you do in your sample, they're in GMT+2.

            SmartGWT deals with dates in GMT/UTC - milliseconds form epoch. If you use SmartGWT to create your test data, you create dates in your current timezone, and they're displayed to you in that way, but stored in GMT.

            You might want to carefully read the Date and Time Storage overview.

            Comment


              #7
              ok, I will do, thanks. If I understand correctly, the times are stored in UTC, and when I take a look at the developer console, I see the GMT+2 value.

              So if I have "21.12.2000 00:00:00" in UTC, I read in the browser "20.12.2000 22:00:00", is this correct?
              But why -2 hours? Shouldn't it be +2 hours, since I have GMT+2? Shouldn't I see "21.12.2000 02:00:00"?

              The components (timeline) are showing their values in UTC format. So for "21.12.2000 00:00:00" I see "21.12.2000 00:00:00" in the timeline. Why am I having here the UTC value? So for displaying you show the GMT value but for the timeline the UTC value? is this correct?

              But the original issue of this thread, where the event is not displayed correctly in the first/last day of the timeline, is still open, correct ?
              Last edited by edulid; 18 Aug 2016, 04:30.

              Comment


                #8
                The components (like Timeline) actually *don't* show their values in UTC format, but in the local browser timezone. If your browser is in GMT+2, and you create a Timeline event at 12am on some date, it will appear at 12am on-screen for you. But the GMT value is 10pm the previous night, and that's what you see being passed around in the dev console.

                Reading the Date & Time Storage overview will clear most of this up for you.

                Yes, we'll still look at the original report.

                Comment


                  #9
                  We don't see your originally reported issue.

                  Probably, this is because your sample is not standalone. You didn't share either your lane-set or your DataSource, so we can only run your sample after a bunch of changes.

                  If you want to provide your data and DS (which you can change to a clientOnly DS so we can run it) and lane-set, we can look further.
                  Last edited by Isomorphic; 22 Aug 2016, 02:20.

                  Comment


                    #10
                    It is very easy to reproduce. Any data-bound timeline has this issue (at least the ones I tried).
                    So here a simple testcase: Just create a new event spanning e.g. 3 days. Then drag-move the even to the very first day and you will see that the event only spans half of the first day (visually). The same for the last day.
                    Using power 6.0p 27.09

                    Code:
                    public class TestingModule implements EntryPoint {
                    
                        private Calendar calendar;
                    
                        public void onModuleLoad() {
                    
                            VLayout vlayout = new VLayout();
                            createCalendar();
                            vlayout.addMember(calendar);
                    
                            vlayout.setWidth100();
                            vlayout.setHeight100();
                            vlayout.draw();
                        }
                    
                        private void createCalendar() {
                            calendar = new Timeline();
                            calendar.setHeight(451);
                            Date now = new Date();
                            calendar.setStartDate(now);
                            Date in3Weeks = new Date();
                            CalendarUtil.addDaysToDate(in3Weeks, 7 - 1);
                            calendar.setEndDate(in3Weeks);
                            calendar.setDataSource("testTimelane");
                            calendar.setStartDateField("f_start");
                            calendar.setEndDateField("f_end");
                            calendar.setNameField("f_name");
                            calendar.setDescriptionField("f_description");
                            calendar.setLaneNameField("f_lane");
                            calendar.setLanes(TimelineLaneData.getNewRecords());
                    
                            HeaderLevel dayHeaderLevel = new HeaderLevel(TimeUnit.DAY);
                            HeaderLevel[] headerLevels = new HeaderLevel[] { new HeaderLevel(TimeUnit.WEEK), dayHeaderLevel };
                            calendar.setHeaderLevels(headerLevels);
                            calendar.setLaneFields(new ListGridField[] { new ListGridField("title", "Personal", 120) });
                    
                            calendar.fetchData();
                        }
                    }
                    Code:
                    <DataSource ID="testTimelane" serverType="sql" tableName="testEvents" autoDeriveSchema="true" >
                    
                    <fields>
                            <field name="f_start" type="datetime" />
                            <field name="f_end" type="datetime" />
                            <field name="f_name" type="text" />
                            <field name="f_description" type="text" />
                            <field name="f_lane" type="text" />
                        </fields>
                    
                    </DataSource>

                    Comment


                      #11
                      Chrome 52.0.2743.116 (64-bit)

                      Code:
                      public class TimelineLaneData {  
                            
                          private static Lane[] records;  
                       
                          public static Lane[] getRecords() {  
                              if (records == null) {  
                                  records = getNewRecords();  
                              }  
                              return records;  
                          }  
                       
                          public TimelineLaneData() {  
                          }  
                       
                          public static Lane[] getNewRecords() {  
                              Lane[] lanes = new Lane[]{  
                                  getLane("charlesMadigen", "Charles Madigen", "Managers"),  
                                  getLane("tamaraKane", "Tamara Kane", "Developers"),  
                                  getLane("darcyFeeney", "Darcy Feeney", "Managers"),  
                                  getLane("kaiKong", "Kai Kong", "Developers"),  
                                  getLane("shelleyFewel", "Shelley Fewel", "Managers"),  
                                  getLane("garretMonroe", "Garret Monroe", "Developers")  
                              };  
                              return lanes;  
                          }  
                            
                          private static Lane getLane(String name, String title, String devGroup) {  
                              Lane lane = new Lane(name, title);  
                              lane.setAttribute("devGroup", devGroup);  
                              return lane;  
                          }  
                       
                       
                      }

                      Comment


                        #12
                        Isomorphic have you been able to reproduce the issue?

                        Comment


                          #13
                          Yes, we also see this one now - internally, the timeline is managed from the exact date passed to setStartDate() - in your case, that date has a time portion.

                          The passed date does get correctly rounded back to the start of the granularity (day, in your case), but it needs to happen a little sooner.

                          We'll make a framework change to deal with this shortly, and a similar case where setStartDate() is not called at all - but in the meantime, you can fix it by just calling setStartDate() with a Date object with the hours, minutes and seconds cleared out, eg:

                          Code:
                                  Date now = new Date();
                                  Date start = new Date(now.getYear(), now.getMonth(), now.getDate(), 0, 0, 0);
                                  calendar.setStartDate(start);

                          Comment


                            #14
                            This has now been fixed - it may have missed the October 3 builds, so it may be October 4 when the changes hit - note that this will be the same build that your other Timeline fix for disabled dates will appear in.

                            Comment


                              #15
                              I have been testing this and the issue with the half-days seems to be corrected. But with the fixed builds I see two new issues:

                              1. When move-dragging an event of a length, for example 1 day, the visual clue always show 1 day more. See screenshot. The event is 1 day long and the visual clue (the red dotted lines) show 2 days.

                              Click image for larger version

Name:	Bildschirmfoto 2016-10-06 um 12.50.34.png
Views:	60
Size:	120.4 KB
ID:	240611


                              2. I am not able to create events shorter as one day. Even if I edit the event details to be half a day, the event seems to be the whole day long. See the screenshot below. The event is from 00:01 to 07:00, but it shows the whole day long.
                              Click image for larger version

Name:	Bildschirmfoto 2016-10-06 um 12.54.35.png
Views:	71
Size:	146.1 KB
ID:	240612

                              Using 6.0-p20161005 power

                              Comment

                              Working...
                              X