Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

checkIf date do not work

  • #6196
    Avatar photo[anonymous]

    Hi.

    I have problem comparing diffrent dates.

    // this do not work, result always false.
    
    {{#checkIf (date createdAt) '!=' (date modifiedAt)}}
    
    // this does work, but I want to have true only if it has been edited on a later day.
    
    {{#checkIf createdAt '!=' modifiedAt}}
    
    // the full code.
    
    {{#checkIf (date createdAt) '!=' (date modifiedAt)}}
            - Last edit
      <time datetime="{{date modifiedAt 'YYYY-MM-DDTHH:mm'}}">{{date modifiedAt}}</time>
    {{/checkIf}}
    #6207
    Avatar photo[anonymous]

    Hi,

    Unfortunately use of the date helper as subexpression currently is not possible due fact, that it returns SafeString object – that’s why you get always false.

    In v.0.39 I will add a third param for the date helper, which will allow developers to return raw data from the date helper: https://github.com/GetPublii/Publii/issues/1019