Hours till next 8am

Hi everyone

I cannot figure out how to calculate the hour till the next 8am in a template.

So if it is 9pm it should return 11 and when it is 3am it should return 5.

How todo that?
today_at does not work as it is potentially the next day.

Thank you

{% set now = now() %}
{% set target = now.replace(hour=8, minute=0, second=0, microsecond=0) %}
{% if now.hour >= 8 %}
  {% set target = target + timedelta(days=1) %}
{% endif %}
{{ ((target - now).total_seconds() / 3600) | round(0) }}

Thank you that works!