Using Liquid to Set a Future Date in the Reminder Email

  • 12 October 2023
  • 0 replies
  • 28 views

 

Introduction

 

This post addresses a common scenario where you may want to add a Liquid into a reminder email to display a future date. Specifically, we'll show you how to display the current date plus 7 days.

 

Problem

The aim here is for a reminder email to display a date that is exactly 7 days from the day the email was sent. This would serve as an reminder for users, that their trial is expiring.

 

Solution

Our tech support team offers a simple solution to this problem. They provided a Liquid code, which when added to your email, will render without any errors. It will allow your users to see the deadline for their portal activation, which is 7 days from the current date.

Here is how the Liquid code looks:

{{ 'now' | date: '%s' | plus: 0 | add_day: 7 | date: '%B %d, %Y'}}

Within the body of the email, this is an example of how it would be applied:

Thanks for signing up for your free trial! You have until {{ ‘now’ | date: ‘%s’ | plus: 0 | add_day: 7 | date: ‘%B %d %Y’}} to enjoy free access to the platform. 

 

And this is how it would look in a rendered email:

Thanks for signing up for your free trial! You have until October 19th, 2023 to enjoy free access to the platform. 

 

And that’s it!


0 replies

Be the first to reply!

Reply