Solved

How to create date variable to use in countdown until Christmas?

  • 3 October 2023
  • 1 reply
  • 72 views

Badge

Hi, I’m trying to add a “X days until Christmas” line to my email where X is the difference between today’s date and 25th Dec, as a count.

I’ve tried using Django’s timeuntil function:

{{ xmas|timeuntil:today }}

but unsure how to define “xmas”? {% with xmas=date(2023, 12, 25) %} is giving an error

Would appreciate any help with this! Hoping to avoid using a timer as I want it to look human

icon

Best answer by Taylor Tarpley 4 October 2023, 19:34

View original

1 reply

Userlevel 7
Badge +60

Hi there @yayifications

 

Thanks for sharing your question with us! Happy to help! 

 

I would recommend utilizing a countdown timer for this use case! However, I do believe that your xmas date is configured incorrectly about as well. I believe the date would need to be as follows instead of the commas.

date:'Y-m-d'

 

Thanks for participating in the Community!

-Taylor 

Reply