On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I've recently started switching my site over to pdoTools. It's gone well so far, but I've run into an issue replacing getPage/getResources on my blog setup.

    Using getPage, I had the following line in my tpl file, which displays the createdon date as "X days X weeks X months ago" and hovering over that text shows the publishedon date in a jQuery tooltip.
    <span class="tip date-tip" data-tip="[[+publishedon:strtotime:date=`%b %d, %Y - %I:%M %P`]]">[[+createdon:ago]]</span>

    Switching over to pdoPage, my snippet call looks like this:
    [[!pdoPage? &parents=`6` &limit=`5` &sortby=`publishedon` &sortdir=`DESC` &tpl=`blogPostSummary`]]

    The blogPostSummary chunk looks like this:
    <div class="post-summary-box gray-box">
        <h3><a href="[[~[[+id]]]]">[[+longtitle:is=``:then=`[[+pagetitle]]`:else=`[[+longtitle]]`]]</a></h3><a class="comments-link" data-disqus-identifier="page-[[+id]]" href="[[~[[+id]]? &scheme=`full`]]/#disqus_thread">Comments</a>
        <p class="post-info">Posted <span class="tip date-tip" data-tip="[[+publishedon:strtotime:date=`%b %d, %Y - %I:%M %P`]]">[[+createdon:ago]]</span> in [[!TaggerGetTags? &resources=`[[+id]]` &rowTpl=`taggerRowTpl` &separator=`, ` &target=`14`]].</p>
        <div class="entry">
            <a class="read-more-link" href="[[~[[+id]]]]">Continue Reading</a>

    If I use only [[+publishedon]] or [[+createdon]], it displays the date in unix timestamp as expected, however with any sort of output formatting the publishedon tag shows nothing and the createdon tag shows "47 years, 2 months ago". Searching around Google and the forums hasn't produced any issues like mine that I've found.

    I appreciate any help!

    This question has been answered by Bruno17. See the first response.

    • discuss.answer
      since this values are stored as unix-timestamp in the db, and pdoTools doesn't convert them to strings, you don't need the strtotime - outputfilter

        you can buy me a beer, if you like MIGX


      • Thank you!

        Is there anything I can change with [[+createdon:ago]] for it to display the correct "time since posted"? I actually don't remember where I found the :ago modifier, I couldn't find any information on it again.
          • ■ email: lk@alienbuild.uk | ■ website: https://alienbuild.uk

            The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
          • try
            [[+createdon:date=`%Y-%m-%d %H:%M:%S`:ago]]

              you can buy me a beer, if you like MIGX