Announcement

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

    Display error for some dates with the MM/YYYY format

    Hi,
    Am using
    Browser : Chrome Ver 88.0.4324.150 (Build ufficiale) (a 64 bit)
    Smart client: version for customer 10.0, for test i have used 10.0 and 12.1

    https://www.smartclient.com/smartcli....html#dateItem
    https://www.smartclient.com/smartcli...e/?id=dateItem

    The problem is simple, I set as date format MM/YYYY by modifying dateItem.js like this:
    {name:"directInputDate", title:"Direct Input Date", type:"date", useTextField:true, wrapTitle:false,
    change:"dateLabel.setContents(value)", dateFormatter: "MM/YYYY"}


    If you set a date greater than or equal to January 4, 2021 or less than or equal to December 31, 2020, the displayed date is correct.
    If I try a date from January 1st to January 3rd 2021 the displayed date is: 01/2020.

    I haven't tried all the dates, so I don't know of any other use cases.


    Thanks in advance for any feedback.


    #2
    Hi Enri_000,

    please see the docs for dateFormatter. Type is DateDisplayFormat, so it should be one of the strings there.

    Best regards
    Blama

    Comment


      #3
      Hi Blama
      Thank you for your answer.
      But I think it is necessary to clarify the problem.
      If I put a date between 1 and 3 January 2021, the displayed date is 01/2020.
      The year is wrong.
      For the other dates I tried everything is correct.

      Comment


        #4
        The problem is likely just the casing of YYYY - use yyyy instead, and that should address your problem. See the doc for the "format" attribute, and FormatString, for details.
        Last edited by Isomorphic; 12th Feb 2021, 08:12.

        Comment


          #5
          Hi Isomorphic,

          I can see the OP's problem in Chromium and how your suggestion from #4 solves it. But IMHO this is not in accordance with the docs, as the value should be type:DateDisplayFormat according to the docs. Also this would not work in SmartGWT's FormItem.setDateFormatter(DateDisplayFormat ddf).

          Best regards
          Blama

          Comment


            #6
            Yes, for clarity, the dateFormatter property takes just the string listed under DateDisplayFormat and it's the "format" property that takes format strings similar to Java's SimpleDateFormat.

            However, as an undocumented behavior (don't rely on it) we made it so that if you confuse the two properties, applying a format string to dateFormatter also works. Doesn't apply to SGWT, where the enum makes this impossible.

            Comment


              #7
              Hi Isomorphic,

              OK, thanks.

              Best regards
              Blama

              Comment

              Working...
              X