using date().diff() for simple countdown

michaelsteelemichaelsteele Posts: 42Member
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 Posts: 166Administrator, Moderator, Lightspeed Staff 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.