Cannot set Date object as default value for date form field

XMLWordPrintable

    • Type: Bug Report
    • Resolution: Won't Fix
    • Priority: L3 - Default
    • None
    • Affects Version/s: 7.10.0
    • Component/s: engine
    • None

      When a form field default value is set to a date object (i.e. ${date}), the task can't be rendered in Tasklist.

      The Date value is converted to String using date.toString() (which uses date format "EEE MMM dd HH:mm:ss z YYYY") and then is being tried to be parsed using default date format ("dd/MM/yyyy"). See this line: https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/form/type/DateFormType.java#L98

      Currently I have 2 options:
      1. Use dateFormat = "EEE MMM dd HH:mm:ss z YYYY" - the date is successfully parsed back and forth using that format, however, Tasklist will render the field using that format, which is ugly for a date picker.
      2. Convert the value to String manually in my bean using my own dateFormat ("dd/MM/yyyy") - i.e. use ${dateUtil.format(date)} for default value

      Possible solutions:
      1. If convertFormValueToModelValue() parameter is of type Date, do not attempt to convert it to String and then parse it - just return it instead.
      2. If we really want to convert it to String and back to Date for some reason, use provided dateFormat.parse(date) instead of date.toString()

      The problem is described in detail here: https://forum.camunda.org/t/date-form-field-default-value/7788

        This is the controller panel for Smart Panels app

              Assignee:
              Thorben Lindhauer
              Reporter:
              Alan Sambol
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: