Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-367

DatePicker ignores format parameter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0
    • 4.0
    • Framework
    • None
    • Tapestry 4.0-beta-2-snapshot and 4.0-beta-1

    Description

      The DatePicker does not use the format parameter to format the date as specified.

      code patch (starting at line 118):

      DateTranslator translator = (DateTranslator) getTranslator();
      Locale locale = getPage().getLocale();
      SimpleDateFormat format = translator.getDateFormat(locale);

      with:

      DateTranslator translator = (DateTranslator) getTranslator();
      if (!(getFormat() == null || getFormat().equals("")))

      { translator.setPattern(getFormat()); }
      Locale locale = getPage().getLocale();
      SimpleDateFormat format = translator.getDateFormat(locale);

      i.e. add :

      if (!(getFormat() == null || getFormat().equals(""))) { translator.setPattern(getFormat()); }

      I am not sure whether this is the correct approach but it works, and I am not sure of the affect this will have on the new validation system where a translator is specified.

      The problem I was having was that I was specifying a format="'dd/MM/yyyy'" but it was always coming out as MM/dd/yyyy even though the browser and locale when tested in java code was reading en-gb, this should be overridden by format anyway.

      Attachments

        Activity

          People

            pferraro Paul Ferraro
            seloha Paul Green
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: