How to change timeago output to a normal date after 7 days?

I’m using Ghost’s built-in timeago=true to display relative timestamps for my blog posts. However, timeago continues showing “X days ago” indefinitely, even for older posts.

I want to modify the behavior so that:

  • For posts less than 7 days old → Show “5 minutes ago”, “3 days ago”, etc.
  • For posts older than 7 days → Display a normal formatted date (e.g., “Feb 10, 2024”).

Currently, I am using this in my theme:

<time class="card-post-date" datetime="{{date format="YYYY-MM-DDTHH:mm:ss"}}">
    {{date published_at timeago=true}}
</time>

I tried using conditional Handlebars helpers like {{#if}}, but since Ghost does not support direct date comparisons (gt, lt), I couldn’t get it to work.

You need #match, which can do inequalities.

I tried

{{#match (date published_at format="X") "<" (date format="X" subtract="7 days")}}
    {{date published_at format="MMM D, YYYY"}}
{{else}}
    {{date published_at timeago=true}}
{{/match}}

But still no change after 7 days.