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; 30th 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; 8th 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
                    It all seems to be working fine with the update - thanks !

                    Regards,
                    --
                    Eric

                    Comment


                      #11
                      Great - this is a tricky area, so please let us know right away if you spot any other foibles.

                      Comment

                      Working...
                      X