Sign in

checkIf date do not work

  • This topic has 1 reply, 2 voices, and was last updated 1 month, 3 weeks ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6196
    t79

    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
    Tomasz Dziuda

    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

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.