Determining how many days until a date is reached

If I was using a helper called "vacation_start" how would I write a sentence that I could use in a Text-to-speech message that would tell me how many how many days until it started? If it was to start tomorrow I would want the answer to be 1.

Thanks, Rich

Copy-paste this into the Template Editor and confirm it reports the number of days you expect:

{{ ((states('input_datetime.vacation_start') | as_datetime | as_local).date() - now().date()).days }}
1 Like

That solution works

  {{ (states('sensor.expirydate') | as_datetime or
  now()) - timedelta(days=14) < now()}}

my way to check if my certificate will expire within the next 14 days

Glad to hear it.

Please consider marking my post above with the Solution tag. You marked your own post but it doesn’t contain any information that solves the problem. The purpose of the Solution tag is to help other users find answers to similar questions. Only one post in the entire thread can be marked with the Solution tag.

For more information, refer to guideline 21 in the FAQ
.