FreeMarker WebEngine - Expected a hash, but this has evaluated to a date_or_time_or_datetime

Hi,

I try to migrate my LTS2019 webEngine app to LTS2021 and I have freemarker code problem .

...
<#function get_date doc modified_date
    <#list doc.children as child>
      <#if modified_date.time?datetime == child.dublincore.modified.time?datetime>
          <#local modified_date = child.dublincore.modified>
      </#if>
      <#if doc.isFolder>
          <#local modified_date = get_date(child, modified_date)>
      </#if>
    </#list>
    <#return modified_date>
</#function>
...

When I try to access docuents, I have this exception :

exception_message : For "." left-hand operand: Expected a hash, but this has evaluated to a date_or_time_or_datetime (wrapper: f.t.SimpleDate):
==> modified_date  [in template "file:/var/lib/nuxeo/server/nxserver/web/root.war/modules/nuxeo-utt/skin/views/Document/index.ftl" at line 21, column 22]

----
FTL stack trace ("~" means nesting-related):
    - Failed at: #if modified_date.time?datetime == ch...  [in template "file:/var/lib/nuxeo/server/nxserver/web/root.war/modules/nuxeo-utt/skin/views/Document/index.ftl" in function "get_date" at line 21, column 17]
    - Reached through: ${get_date(child, child.dublincore.mo...  [in template "file:/var/lib/nuxeo/server/nxserver/web/root.war/modules/nuxeo-utt/skin/views/Document/index.ftl" at line 55, column 29]
    - Reached through: @block name="content"  [in template "file:/var/lib/nuxeo/server/nxserver/web/root.war/modules/nuxeo-utt/skin/views/Document/index.ftl" at line 5, column 1]
    - Reached through: @extends src="base.ftl"  [in template "file:/var/lib/nuxeo/server/nxserver/web/root.war/modules/nuxeo-utt/skin/views/Document/index.ftl" at line 1, column 1]
----

How can I workaround this issue ?

thanks a lot

0 votes

1 answers

496 views

ANSWER



Hello

When I try to display child.dublincore.modified.time, I got the same error. So I assume that in LTS2021, the is no more .time attribut in modified date ?

Thanks

0 votes