I have a bit of an urgent ask so any quick responses would be appreciated.
I want to find the difference between the current date and another date in the email template and render content based on the value of the difference (i.e. let's say the date today is 02/12/2024 and the date attribute of another field is 02/08/2024. I'd then like to find the difference between these two dates which will be 4 and render content based on that)
I know this can be done within the AJO conditions but how can I do this within the emails?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
@trojan_horse Example function with dates,
{%#if profile.person.birthDate.getDayOfYear() - now.getDayOfYear() = 4 %}
test1
{%else%}
test2
{%/if%}
@trojan_horse, You can use Date Difference function given here.
I've tried but that only seems to take dateTime values and I just have the dates. Could you give an example of how this can be used with just the dates?
Views
Replies
Total Likes
@trojan_horse Example function with dates,
{%#if profile.person.birthDate.getDayOfYear() - now.getDayOfYear() = 4 %}
test1
{%else%}
test2
{%/if%}
Following expression can be leveraged to find the difference between date fields
{% let currentDate = now %}
{% let currentDayOfYear = dayOfYear(currentDate) %}
{%#if currentDayOfYear - dayOfYear(<another date field>) = 4 %}
element_1
{%else%}
default_element
{%/if%}