Announcement

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

    Timeline displays wrong week number.

    SmartGWT Pro 5.0-p20160608 (had earlier version, upgraded to verify problem is still there). Tried various browsers, all show same problem.

    Today it's 11:th of June. This is week 23 in Sweden and rest of Europe, but my Timeline shows it as week 22. This is incorrect.

    I have tried both with english and swedish locales (setting the gwt:property to en_GB and sv_SE in the html), the only thing that changed was first day of week.

    See attached screenshot, and find a simple code example below.

    Please let me know if there is anything i can do programmatically to sort this out, or if you have another solution. (i tried setting dayofweek manually below as you can see, doesn't change anything)

    Code:
    public class Test implements EntryPoint {
    
        public void onModuleLoad() {
            initLayout();
        }
    
    
        public void initLayout() {
            VLayout mainLayout = new VLayout();
            mainLayout.setWidth(500);
            mainLayout.setHeight(300);
            mainLayout.setMembersMargin(30);
            mainLayout.setLayoutTopMargin(20);
    
            GenericTimeline timeline = new GenericTimeline(null, null, false);
            HeaderLevel week = new HeaderLevel(TimeUnit.WEEK);
            week.setHeaderWidth(100);
            HeaderLevel day = new HeaderLevel(TimeUnit.DAY);
            day.setHeaderWidth(100);
            timeline.setHeaderLevels(new HeaderLevel[]{
                week, day
            });
            timeline.setFirstDayOfWeek(1);//no impact
    
            mainLayout.addMember(timeline);
            mainLayout.draw();
        }
    }
    Attached Files
    Last edited by mathias; 11 Jun 2016, 03:41.

    #2
    Week 1 is considered to be the one containing the first Thursday *on or after* January 1.

    In this case, January 1 is a Friday, so Week 1 starts on January 3 in the UK (where firstDayOfWeek is 0) and January 4 in those countries where firstDayOfWeek is 1.

    Comment


      #3
      We see the issue you mention in SGWT 5.0p/SC 10.0p. This should be fixed in the latest version of SGWT 5.1p/SC 10.1p - can you move to 5.1p?

      Comment


        #4
        I'm sorry but i don't think that's true. Sweden, along with UK both have adopted 8601 officially, see for example this Wikipedia page: https://en.wikipedia.org/wiki/Date_a...United_Kingdom
        You can also easily find lots of internet places where they list calendars with week numbers:
        http://www.epochconverter.com/weeks/2016
        https://weeknumber.co.uk/calendar/england/2016

        This means, that according to my knowledge that when i write this, today on June 14:th 2016, it is week 24 in UK, Sweden and most other countries. This is also what your showcase shows (that runs 6.0 i think). It is also what shows when i bring up Calendar for both Swedish and UK locale on Mac and Windows, and all the links i just provided.

        HOWEVER, in the test i provided, which runs 5.0 as i describe above, it shows week 23!

        It does not matter what i set the locale to using
        Code:
        <meta content="locale=sv_SE" name="gwt:property"/>
        Nor does it matter if i call timeline.setFirstDayOfWeek to 0 or 1, it still shows week 23 today, when it should show 24.

        I don't think this is correct.

        Comment


          #5
          I now see that you just posted a response :)

          I would LOVE to upgrade to 5.1, and we're ready to pay for an upgrade to 6.0, but we have a showstopping issue with 5.1 that i detailed in another thread and you do not want to look at.

          http://forums.smartclient.com/forum/...-broken-in-5-1

          Until this is resolved, its unfortunately impossible for us to upgrade, and i really suck at debugging javascript (this is one of the main reasons as to why we purchased smartgwt in the first place...).

          If you would reconsider helping us out with that issue, it would really be appreciated. I wrote a test-case and everything!! :)
          Last edited by mathias; 14 Jun 2016, 00:01.

          Comment

          Working...
          X