Document toolboxDocument toolbox

Conditional Date Join

Summary / TL:DR: This article is a liquid script code example of conditional date join.


Conditional date join

{% capture today_1 %}{{ "now" | date: "%s" }}{% endcapture %} {% capture fake_join_1 %}{{ "April 10, 2021" | date: "%s" }}{% endcapture %} <br> {% comment %} This is converting datetimestamps to number of seconds. fake_join_1 can be replaced by the user_transaction.date_joined attribute. {% endcomment %} {%capture datejoin_diff %}{{today_1 | minus: fake_join_1 | divided_by: 86400}}{% endcapture %}<br> {% comment %} Number of seconds in 1 day is 86400 {% endcomment %} {{datejoin_diff}} is the differennce between fake join date and today's date<br> <strong>This shows conditional content based on fake join date:</strong><br><br> {% if {{datejoin_diff}} >= "12" %} Display this content {% else %} Some other content {% endif %}

Wrap up

You should now have a liquid script code example of conditional date join.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'html-macro' is unknown.