Skip to main content
Solved

Issues utilising "timesince" filter

  • 12 June 2024
  • 3 replies
  • 31 views

I am experimenting using conditional statements in my email. I have a condition if a user has “fashion” as interested category, and am trying to add, or if they have joined in the last 90 days. I have a flow that creates a custom property, and sets it as the day the user joins the list. I am utilising the filter timesince so I can filter out those who are greater than 90 days. 

 

When I try this code, it saves fine, and I can preview for those who don’t have that specific property. However if I preview for someone with the property, I receive 

 

3 replies

Userlevel 5
Badge +26

Hello @benjamin.ngo 

Try this:

{% assign current_date = "now" | date: "%s" %}

{% assign target_date = person|lookup:’Created’ | date: "%s" %}

{% assign ninety_days_ago = current_date | minus: 7776000 %}  

{% if target_date < ninety_days_ago %}

<!-- Date is more than 90 days ago -->

Do something

{% else %}

<!-- Date is within the last 90 days --> Do something else

{% endif %}

Badge +1

Hello @benjamin.ngo 

Try this:

{% assign current_date = "now" | date: "%s" %}

{% assign target_date = person|lookup:’Created’ | date: "%s" %}

{% assign ninety_days_ago = current_date | minus: 7776000 %}  

{% if target_date < ninety_days_ago %}

<!-- Date is more than 90 days ago -->

Do something

{% else %}

<!-- Date is within the last 90 days --> Do something else

{% endif %}

Hi @Maxbuzz 

Whenever I use the assign tag it returns this.

I assume it isn’t a function supported by Klaviyo

Userlevel 7
Badge +60

Hi there @benjamin.ngo

 

I don’t believe it’s possible, however, I will double check with out team and come back with an update if they say otherwise!

 

-Taylor 

Reply