DDayThistle
Product

Product features · Holiday-aware working-day shifts

01

Use working_days.py to check working-day movement across weekends, listed holidays and the limits of the calendar.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Holiday-aware working-day shifts

● ● ●DayThistle●
A concrete starting point · Holiday-aware working-day shifts ×
from datetime import date, timedelta

def working_day_shift(start, days, holidays):
    if type(start) is not date or type(days) is not int or not -366 <= days <= 366:
        raise ValueError("days.input")
    if type(holidays) is not set or len(holidays) > 1000 or any(type(d) is not date for d in holidays):
        raise ValueError("days.holidays")
    remaining, step = abs(days), 1 if days >= 0 else -1
    for _ in range(7*(remaining+len(holidays))+7):
        if remaining == 0:
            return start
        try:
            start += timedelta(days=step)
        except OverflowError as error:
            raise ValueError("days.range") from error
        if start.weekday() < 5 and start not in holidays:
            remaining -= 1
    raise RuntimeError("days.steps")
✳Holiday-aware working-day shifts
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗