Click
  1. Click
  2. CLK-610

DateField formatPattern should not be static string, but static variable

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
      None

      Description

      DateField constructors contain this code:

      super(...);
      ...
      setFormatPattern("dd MMM yyyy");
      (yes, same code 3 times

      I suggest to replace it with this:

      public static String defaultFormatPattern = "dd MMM yyyy";

      super(...);
      ...
      setFormatPattern(defaultFormatPattern);

        Activity

        Hide
        Bob Schellink added a comment -

        Fixed in trunk.

        Show
        Bob Schellink added a comment - Fixed in trunk.
        Hide
        Malcolm Edgar added a comment -

        While this is an improvement over the previous version which had a magic string value, the default value should probably be loaded from a DateField.properties file, as format patterns are local specific.

        regards Malcolm Edgar

        Show
        Malcolm Edgar added a comment - While this is an improvement over the previous version which had a magic string value, the default value should probably be loaded from a DateField.properties file, as format patterns are local specific. regards Malcolm Edgar
        Hide
        Andrew Fink added a comment -

        Standard Java has similar feature:

        http://java.sun.com/javase/7/docs/api/java/text/DateFormat.html
        http://java.sun.com/docs/books/tutorial/i18n/format/dateFormat.html

        but I can't find how to extract String pattern from DateFormat object,
        but my research wasn't long!

        Just don't forget: date format is a matrix:

        one axis: language/country
        other: format SHORT-to-FULL and date, time or date&time

        Show
        Andrew Fink added a comment - Standard Java has similar feature: http://java.sun.com/javase/7/docs/api/java/text/DateFormat.html http://java.sun.com/docs/books/tutorial/i18n/format/dateFormat.html but I can't find how to extract String pattern from DateFormat object, but my research wasn't long! Just don't forget: date format is a matrix: one axis: language/country other: format SHORT-to-FULL and date, time or date&time
        Hide
        Bob Schellink added a comment -

        calendar pattern is now loaded from resource bundle

        Show
        Bob Schellink added a comment - calendar pattern is now loaded from resource bundle

          People

          • Assignee:
            Bob Schellink
            Reporter:
            Andrew Fink
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development