Announcement

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

    Issue with time zone + format in DateItem

    Using a time zone that shifts to the next date (relatively to the browser time zone) in combination with a custom short display format, we're getting an issue with DateItem.

    Locally, we're March 29th.
    I'm using a time zone offset of +16:00 (Pacific Fiji) (enough of a difference to make it tomorrow in that time zone)

    When I pull up the time picker, the 30th is highlighted - this is perfect, as we are March 30th in Fiji time.

    The issue comes when I pick it... once I click on the 30th, the date gets offset a second time... and March 30th ends up being displayed.

    Adding DateUtil.setInputFormat makes things even odder- the date gets an extra day bump... and gets an extra day every time the date picker loses focus.

    We reproduced it in a testbed under SmartClient v12.0p_2021-03-17:

    Code:
            
            DateUtil.setShortDisplayFormat('yyyy-MM-dd');
            DateUtil.setInputFormat('YMD');
            Time.setDefaultDisplayTimezone ('+16:00');
    
            var form = isc.DynamicForm.create({
                numCols : 1,
                width : 300,
                fields : [{
                    name : 'message',
                    type : 'date',
                    editorType : 'DateItem',
                    useTextField : true,
                    title : 'Date picker'
                }]
            });
    
            form.show();
    Interestingly, the problem disappears if we don't have a custom format... suggesting that the date formatting feature might be re-offsetting the date instead of keeping it as a "logical date" internally.

    Regards,
    --
    Eric
    Last edited by eric.maziade.afsi; 30 Mar 2021, 05:14.

    #2
    Apologies for the delay in replying - a fix for this was applied some days ago, but only to our 13.0 and 12.1 versions.

    We'll port it to 12.0 today.

    Comment


      #3
      Originally posted by Isomorphic View Post
      Apologies for the delay in replying - a fix for this was applied some days ago, but only to our 13.0 and 12.1 versions.

      We'll port it to 12.0 today.
      Thanks. Looking forward to it.

      Regards,
      --
      Eric

      Comment


        #4
        The necessary changes have been ported to 12.0 and will appear in the next build dated April 9 or later.

        Note that you *do* need to setInputFormat("YMD") and install a datetime version of your custom-format, in order for parsing to work properly in both date and datetime items.
        Last edited by Isomorphic; 8 Apr 2021, 13:26.

        Comment


          #5
          Originally posted by Isomorphic View Post
          The necessary changes have been ported to 12.0 and will appear in the next build dated April 9 or later.

          Note that you *do* need to setInputFormat("YMD") and install a datetime version of your custom-format, in order for parsing to work properly in both date and datetime items.
          I've waited a few days, but the latest nightly is still SmartClient_v120p_2021-04-03_Pro.zip (we're April 13th).

          Comment


            #6
            Tried the latest update. Most of it is working, but there is an issue left wit the "today" button, which is a bit harder to reproduce.

            If you take a look at `DateChooser.todayClick` in ISC_Forms, you'll see that it gets the date from a new Date() object - which causes the browser's time zone to be applied to the result.

            It should most likely be using a `Date.getLogicalDateOnly(new Date())` instead, which serves to get over this hurdle.

            Here's my test situation:
            • DefaultDisplayTimeZone is +12:00 (to match Fiji TimeZone).
            • Browser time is currently 2012-04-14 10:00 AM (EDT)
            • Current time in Fiji is 2012-04-15 02:00 AM (GMT+12)
            • isc.DateUtil.getAsDisplayDate(new Date()) = Wed Apr 14 2021 22:04:20 GMT-0400 (Eastern Daylight Time)
            • By comparison, using Date.getLogicalDateOnly(new Date()) = Thu Apr 15 2021 12:00:00 GMT-0400 (Eastern Daylight Time)
            • Clicking on "Today", will move the date back to 2012-04-14, which is yesterday in Fiji time.
            Reagards,
            --
            Eric

            Comment


              #7
              This had already been fixed in later versions (not recently) and we'll port the fix back to 12.0 today. Please retest with a build dated April 15 or later.

              Comment


                #8
                Great! Thank you. Looking forward to it.

                Regards,
                --
                Eric

                Comment


                  #9
                  In fact, this one hadn't been fixed in later versions - but it has now :)

                  Comment


                    #10
                    Hello.

                    We recently went live with our time zone solution, making use of the resolutions above.

                    Our users ended up finding a new issue related to the "default display time zone".

                    We have it on our 12.0 setup (confirmed it as being an issue on 12.1 as well).

                    Basically, a good enough difference of time offset between the browser and display time zone can cause the months to be mislabeled in the time zone picker.

                    Here's a screenshot of the reproduced problem where all months in the picker are labeled as the preceding month.

                    Click image for larger version  Name:	Screenshot 2021-08-04 043357.png Views:	0 Size:	15.4 KB ID:	266067

                    Here is the HTML snippet to reproduce the issue (html explains how to setup the operating system environment to reproduce)


                    Code:
                    <p>Set your local time zone to something that is 13 hours after the target offset of -05:00; you'll need to restart the browser for it to pickup the system time zone change.</p>
                    <p>Ex: Brisbane (+10:00)</p>
                    
                    <p>Open up the date picker and click to change the month. "January" will be labeled "December"; I expect it is due to the internal representation of the date holding a time of 12:00 which would be brought back more than 12 hours into the preceding day and month)</p>
                    
                    <script type="text/javascript">// <![CDATA[
                    
                    // Still messes up with a double conversion.
                    
                    DateUtil.setShortDisplayFormat('yyyy-MM-dd');
                    DateUtil.setInputFormat('YMD');
                    Time.setDefaultDisplayTimezone ('-05:00');
                    
                    var localOffset = new Date().getTimezoneOffset() / 60;
                    document.write('<p>Effective offset in hours ' + (localOffset - 5) + '</p>');
                    
                    if (localOffset - 5 > -12) {
                    document.write('<p>Offset not good enough to illustrate the issue</p>');
                    }
                    else {
                    document.write('<p>Your current setup should illustrate the issue</p>');
                    }
                    
                    var form = isc.DynamicForm.create({
                    numCols : 1,
                    width : 300,
                    top : 200,
                    fields : [{
                    name : 'message',
                    type : 'date',
                    editorType : 'DateItem',
                    useTextField : true,
                    title : 'Date picker'
                    }]
                    });
                    
                    form.show();
                    // ]]>
                    
                    </script>
                    Last edited by eric.maziade.afsi; 3 Aug 2021, 11:44.

                    Comment


                      #11
                      Thanks for the detailed report - we've fixed this for builds of 12.0+, dated August 5 or later.

                      Comment


                        #12
                        Thank you for the fast response !

                        Comment


                          #13
                          Originally posted by Isomorphic View Post
                          Thanks for the detailed report - we've fixed this for builds of 12.0+, dated August 5 or later.
                          Hello,

                          As of today, when I download the latest from 12.0, I get SmartClient_v120p_2021-07-06_Pro. Will there be a new build with for August 5 or later ?

                          Comment


                            #14
                            Thanks for the notification - we have someone looking at why the 12.0 nightly builds have stalled and will let you know when a new version is available

                            Comment


                              #15
                              12.0 nightly-builds have been restored - please retest with a build dated August 8 or later.

                              Comment

                              Working...
                              X