Forum Discussion
Rajorigin
7 months agoSpecialist
Liquid help to personalise dates as "today", "tomorrow" and yesterday
Hello friends, Hope you are all well. I need some liquid help from you. We are using a date from the canvas_entry_property i.e. {{canvas_entry_properties}}.${{creation_date}} and we want to use the ...
- 7 months ago
Hey Raj! Here's what I have so far. You'll most likely have to make format changes and also consider timezone differences. You can adjust the date inside "creation_date" to test different values.
{% assign creation_date = "2024-04-27" %} {% assign creation_date_unix = creation_date | date: "%s" %} {% assign today_unix = "now" | date: "%F" | date: "%s" %} {% assign difference = creation_date_unix | minus: today_unix %} {% if difference < 0 %} Thank you for being a member with us since yesterday! {% elsif difference == 0 %} Thank you for being a member with us since today! {% elsif difference <= 86400 %} Thank you for being a member with us starting tomorrow! {% elsif difference > 86400 %} Thank you for being a member with us starting {{creation_date}}! {% endif %}
AllanHeo
7 months agoStrategist
Hey Raj! Here's what I have so far. You'll most likely have to make format changes and also consider timezone differences. You can adjust the date inside "creation_date" to test different values.
{% assign creation_date = "2024-04-27" %}
{% assign creation_date_unix = creation_date | date: "%s" %}
{% assign today_unix = "now" | date: "%F" | date: "%s" %}
{% assign difference = creation_date_unix | minus: today_unix %}
{% if difference < 0 %}
Thank you for being a member with us since yesterday!
{% elsif difference == 0 %}
Thank you for being a member with us since today!
{% elsif difference <= 86400 %}
Thank you for being a member with us starting tomorrow!
{% elsif difference > 86400 %}
Thank you for being a member with us starting {{creation_date}}!
{% endif %}
Related Content
- 2 years ago