Hi all
Does anyone know of a way to simulate a datediff function using metadata dates and/or comparing to current time?
e.g.
We want to display a "New!" icon at the top of the page if it has been published in the last week, but after that time the icon not display.
I couldn't find a way to do this using keyword replacement/modifiers. Was wondering if anyone else knows a way. %asset_published_relative% looks promising, and the online manuals show this type of syntax in an example:
%globals_date_relative_this_friday_d-m-Y%
though I could not find any more info about how to use this and it prints some pretty neat gobbeldeegook that was otherwise pretty useless (at least as far as I could tell). The _relative keywords seem to be designed to be human readable, rather than for programmatic comparison.
I supposed what I'm trying to find is if there is a datediff equivalent.
I have 2 other options for solving this:
1> Use Javascript (probably the easiest)
2> Create an additional metadata field, gets set by a trigger every time it is published to a week in advance, and use that as the comparison (I don't like this approach - seems too heavy-handed).
Was just wondering if there was a way using just keywords and modifiers.
Edit: we are on Matrix v4.12.4