Announcement

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

    DateItem with mask "dd/MM/yy"

    I would like to use a DateItem in a form in order to enter dates in the format "dd/MM/yy". Hence the mask should look like this "__/__/__".

    Entering and parsing dates in the format "dd/MM/yy" is working correctly.
    However, the displayed mask offers 4 characters for the year ("__/__/____") and it should be only two characters.

    I tried to use the methods DateUtil.setShortDisplayFormat() and DateUtil.setInputFormat to centrally set a default date format. It doesn't seem to have an impact on the DateItem mask.

    I use SmartGWT Framework (v10.0p_2014-10-26/PowerEdition Deployment 2014-10-26).
    I have attached a minimum sample.

    Any guess what could be missing?
    Attached Files

    #2
    Read the docs for the methods you're calling such as setInputFormat(). You're passing what appear to be format strings used with Java's SimpleDateFormat, but that's not what these methods expect.

    Comment


      #3
      Thank you for your feedback. I have reviewed and updated the sample code (see attachment).

      Apparently I was not using the correct date format string when calling the method DateUtil.setInputFormat().

      If I understand the Javadoc correctly, the format strings for the methods
      DateUtil.setShortDisplayFormat() and DateTimeFormat.getFormat() should allow format strings in the Java SimpleDateFormat flavor.

      With the updated code, I still see the same problem: the displayed mask displays 4 characters for the year, while I would expect to have two.
      Attached Files

      Comment

      Working...
      X