Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28609

Fix ContextFunctions#formatDate to work with Calendar objects

    XMLWordPrintable

    Details

      Description

      At https://github.com/nuxeo/nuxeo/blob/master/addons/nuxeo-template-rendering/nuxeo-template-rendering-core/src/main/java/org/nuxeo/template/context/extensions/ContextFunctions.java#L164 the dt object is not used to format the date. For the moment the SimpleDateFormat.format method tries to format a Calendar Object which is not supported argument for this method so the following error is thrown :

      java.lang.IllegalArgumentException: Cannot format given Object as a Date
      	at java.base/java.text.DateFormat.format(DateFormat.java:338)
      	at java.base/java.text.Format.format(Format.java:158)
      	at org.nuxeo.template.context.extensions.ContextFunctions.formatDate(ContextFunctions.java:164)
      	at org.nuxeo.template.context.extensions.ContextFunctions.formatDate(ContextFunctions.java:140)
      
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: