I currenty have data in my CMS which outputs this on the front end:
2017-03-16T00:00:00
What I like this to do is check the above date and see how many days is left to that day and display it as: 7 days left (assuming today is the 9th March 2017)
And then when the date reaches 0, it needs to display the text: "Closed"
Currently I have:
{% assign todaysdate = {{todaysdate]}} %}
{% assign todaysdatenew = todaysdate | convert: "date" %}
{% assign formula = {{globals.site.dateNow}} | minus: todaysdatenew %}
{% if {{globals.site.dateNow}} > todaysdatenew %}
Closed
{% else %}
{{formula | date:"%d' days'"}}
{% endif %}
However for some reason it is displaying the result as 6 days left, instead of 7 days left. How do I add 1 extra day?
If it is always one day then you can change just hardcode add the extra day by editing the line below:
{{formula | date:"%d' days'"}}To: