Skip to main content
Solved

Jinja Question: Adding business days to today

  • February 11, 2025
  • 0 replies
  • 369 views

Forum|alt.badge.img+3

In my Pipeline, I have a “start date” and “end date.” The start date is {{ today.now }}. For the end date, I want the pipeline to add 5 business days to the start date. Is there a way to do that?

Best answer by Mez

Here is how you can achieve this in jinja. 

Using isoweekday  Monday is 1 and Sunday is 7. (assumes exclusive)

{% if (time.now.date()).isoweekday() <= 5 %}
{{ time.now.date() + time.delta(days=7) }}
{% elif (time.now.date()).isoweekday() == 6 %}
{{ time.now.date() + time.delta(days=6) }}
{% else %}
{{ time.now.date() + time.delta(days=5) }}
{% endif %}

 

MarkShnierYou
Forum|alt.badge.img+24

There may be a fancy way to do this with Jinja, but an expedient solution is to make a native QuickBase field called [Today plus 5 business days] and use it in the pipeline.

WeekDayAdd([Today(), 5)


Mez
Forum|alt.badge.img+7
  • Registered
  • Answer
  • February 11, 2025

Here is how you can achieve this in jinja. 

Using isoweekday  Monday is 1 and Sunday is 7. (assumes exclusive)

{% if (time.now.date()).isoweekday() <= 5 %}
{{ time.now.date() + time.delta(days=7) }}
{% elif (time.now.date()).isoweekday() == 6 %}
{{ time.now.date() + time.delta(days=6) }}
{% else %}
{{ time.now.date() + time.delta(days=5) }}
{% endif %}