using date().diff() for simple countdown

michaelsteelemichaelsteele Member Posts: 42
I'm having trouble getting this to work; right now coming up empty. Will using the Twig date filters work for this?

{% set difference = date("2018-10-21").diff("now"|date("Y-m-d")) %}
{% set leftDays = difference.days %}
{{ leftDays }} days

1 comment

  • JoeyJoey Administrator, Moderator, Lightspeed Staff Posts: 198 moderator
    Hi Michael,
    After trying this out I can confirm that we do not have the Date_Diff filter installed. I would recommend looking into a solution using Javascript, this is also what other themes use for similar 'countdown' features.
    eCom Support Team
    Lightspeed HQ
Sign In or Register to comment.