Hello,
How would I add a dynamic expiration date to an e-mail so the client would know how long the coupon is valid? I use dynamic coupon codes with 7 day expiration.
Thank you so much,
Gyte
Hello,
How would I add a dynamic expiration date to an e-mail so the client would know how long the coupon is valid? I use dynamic coupon codes with 7 day expiration.
Thank you so much,
Gyte
Best answer by JessFosnough
Hi
Thanks for your question! One way is to use django template tags to insert a dynamic expiration date, based on when the email was sent. For us, it looks like this:
Valid through {% today '%Y-%m-%d' as today %} {{ today|days_later:14|format_date_string|date:'F j, Y' }}
And renders like this:
Valid through May 3, 2024
The resulting day is 14 days after today; you can change it to 7 for your needs. Django also gives more ways to format the date, you might want to play around with the format to see what you want.
Hope this helps!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.