Announcement

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

    Timeline Hours (1 day)

    Hi,
    I'am trying GWT Pro 12.1 released February 05, 2021. In production I'm using GWT Pro 12.0.
    I have a timeline with Hours (1 day) Resolution but the resolution does not work correctly, the hour starts from 12:00 and not 00:00. In version 12.0 the problem does not exist

    How I can fix it?
    I include here an example.

    Thanks a lot


    public class TimelineGroupingSample extends VLayout{
    public void build(){
    HeaderLevel[] headerLevels = new HeaderLevel[] { new HeaderLevel(TimeUnit.DAY), new HeaderLevel(TimeUnit.HOUR) };

    // grouping fields must be specified as laneFields, but can be hidden as is done here
    ListGridField groupField = new ListGridField("devGroup");
    groupField.setHidden(true);
    ListGridField[] laneFields = new ListGridField[]{
    new ListGridField("title", "Developer", 120),
    groupField
    };

    Timeline calendar = new Timeline();
    calendar.setHeight(551);

    calendar.setShowEventDescriptions(false);
    calendar.setEventSnapGap(60);
    calendar.setLaneEventPadding(2); // add a little space around events
    calendar.setStartDate(RelativeDateItem.getAbsoluteDate(RelativeDate.TODAY));
    calendar.setCanCreateEvents(true);

    // grouping settings
    calendar.setCanGroupLanes(true);
    calendar.setLaneGroupByField("devGroup");
    calendar.setLaneFields(laneFields);

    // set up the grid
    calendar.setHeaderLevels(headerLevels);
    calendar.setResolution(headerLevels, TimeUnit.HOUR, 24, null );

    calendar.setLanes(TimelineLaneData.getRecords());
    calendar.setData(TimelineData.getRecords());



    addMembers(calendar);
    }
    Attached Files

    #2
    Instead of using RelativeDateItem.getAbsoluteDate(), which is returning a logicalDate (a date with time set to 12:00), use DateUtil.getStartOf(), ensuring you pass the 3rd parameter, which will return the start of the, in your case, day, in your timezone.

    Edit: we added a follow-up post to this but removed it - the alternate value we suggested, START_OF_TODAY, is documented as being identical to RelativeDate.TODAY.

    We're taking a look at whether there's a bug here.
    Last edited by Isomorphic; 11 Feb 2021, 07:40.

    Comment


      #3
      I used DateUtil.getStartOf and even without setting the date the problem is exactly the same.

      Also, in your showcase: https://www.smartclient.com/smartgwt...ine_resolution, in Hours (1), after choosing a new Date from DateChooser button the hour starts from 12:00.

      In addition I would like only one day (ex: Feb, 11) not the range (Feb, 11-12)

      Thanks a lot.


      Comment


        #4
        Ok, so the DateChooser is producing a logicalDate - we'll take a look and update here shortly.

        Comment


          #5
          Hi, we would like use GWT Pro 12.1 but there is the same error that I have described to you above

          https://www.smartclient.com/smartgwt...ine_resolution

          Can you fix it?
          Thanks a lot

          Comment


            #6
            Changes were made a while ago to address the 12 noon issue - we just tested this at the link you provided, which is running a build from May 1, and we see no issues with dates or times.

            We do see the title label above the timeline showing a range (from date to date+1) - this is just because the end time is midnight, and we'll address the default text.

            Note that you can override Timeline.getDateLabelText() to provide custom text.

            Comment

            Working...
            X