Announcement

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

    Y2K Bug In Date Field For Short Display Format

    In this showcase:
    https://www.smartclient.com/smartcli...e/?id=dateItem

    If you add this to the "directInputDate" field as an attribute:

    format: "dd MMM YYYY"

    Then click "Try It" and enter any one of these as a text date entry and press TAB:

    1/1/2000. 1-1-2000 1/2/2000. 1-2-2000

    Then the visually displayed date is:

    01 Jan 1999 --- or --- 02 Jan 1999


    The underlying field value does actually remain the correct one as entered in the field but the visual display is a year prior.

    The same applies for the date picker - using a startDate that allows picking 1 Jan 2000 from the picker also shows the prior year as the visually displayed date.
    Last edited by chris@umed.io; 27th Nov 2020, 09:16.

    #2
    Hi Isomorphic,
    Any chance this will be fixed in a nightly build?

    Comment


      #3
      Further testing reveals that in fact this occurs for random years with no clear pattern. Using a slightly different format (dd-MMM-YYY) shows exactly the same random behaviour:
      01-01-2010 shows as 01-Jan-2009
      01-01-2000 shows as 01-Jan-1999
      01-01-1999 shows as 01-Jan-1998
      01-01-1989 shows as 01-Jan-1988
      01-01-1978 shows as 01-Jan-1977
      01-01-1949 shows as 01-Jan-1948
      01-01-1939 shows as 01-Jan-1938
      01-01-1938 shows as 01-Jan-1937

      Happy to make a video showing the behaviour in the very latest SmartClient showcase here:
      https://www.smartclient.com/smartcli...e/?id=dateItem

      Comment


        #4
        Further experimenting in the showcase reveals that ANY date format that contains YYYY in it has this issue

        Comment


          #5
          Hi Isomorphic,

          this one is about date entry as well. Also, I can reproduce what the OP is seeing in this thread in FF83/Win10.

          Best regards
          Blama

          Comment


            #6
            This report describes the documented behavior of a FormatString that uses "YY" or "YYYY" in a format - from the docs, "Week year as a [two/four]-digit number (week year is the year associated with the entire week deemed to contain a given date, and it may differ from calendar year. For example, the week year of December 31 2012 is 2013)".

            Just use "yyyy" instead.

            Comment


              #7
              Ah! I finally clicked - - using the wrong case - DOH!
              Last edited by chris@umed.io; 6th Jan 2021, 02:01.

              Comment


                #8
                Just regarding the previous message, before you revised it, when we defined our format strings, we matched Java's SimpleDateFormat format:

                https://docs.oracle.com/javase/7/doc...ateFormat.html

                We did so because of familiarity and the possibility of sharing working date formats from Java applications and examples.

                We agree it's a little weird that they chose to use YYYY to mean a very obscure thing which is mostly the same as yyyy but only different in some cases.

                If we had been able to define the format from scratch we would not have done this.

                Comment

                Working...
                X