How to calculate the number of days left? I want to calculate the remaining days between the current day (now) and a future date set as a date field in {{ inschrijven.datumEvenement }} globals

{{ inschrijven.datumEvenement.diff(now).format('%d') }}


This is what I came up with but it doesn't generate the right number of days left. 

Using now = 05-15-2015, inschrijven.datumEvenement = 08-30-2015 the above tag generates "14".
You want to use "a" as your DateInterval format parameter instead of "d".

Also, you may need to use Twig's date function on the end date, which "converts an argument to a date to allow date comparison".

This should give you the correct number of days between now and the future date:

{{ date( inschrijven.datumEvenement|date ).diff( now ).format('%a') }}


or

{{ date( inschrijven.datumEvenement|date ).diff( now ).days }}