Script for last 3rd business day of the month

I adapted @petro’s answer to a slightly different question to get the result you are looking for:

This template will get the number of days until the next 3rd last business day of the month. For the other formatting you described you can use a markdown card, or add it to this template.

{% set biz_day_offset = [-4, -4, -2, -2, -2, -3, -4] %}
{% set next_month = now().date().replace(day=28) + timedelta(days=4) %}
{% set third_month = next_month + timedelta(days=32) %}
{% set last_day_this = next_month - timedelta(days=next_month.day) %}
{% set last_day_next = third_month - timedelta(days=third_month.day) %}
{% set until_last_biz_day_this = (last_day_this + timedelta(days=biz_day_offset[last_day_this.weekday()]) - now().date()).days %}
{% set until_last_biz_day_next = (last_day_next + timedelta(days=biz_day_offset[last_day_next.weekday()]) - now().date()).days %}
{{ until_last_biz_day_this if until_last_biz_day_this >= 0 else until_last_biz_day_next }}

The business day offset basically says that if the last day of the month is Monday, you have to subtract 4 days to get to the third last business day (Thursday, in that case). Same with Tuesday (Friday), then Wednesday only needs to subtract 2 (Monday), … and so on.