Skip to content

Support periodic day exclusions with off+N/on+N syntax#744

Draft
Copilot wants to merge 4 commits intodevelopfrom
copilot/analyze-exclusions-in-code-base
Draft

Support periodic day exclusions with off+N/on+N syntax#744
Copilot wants to merge 4 commits intodevelopfrom
copilot/analyze-exclusions-in-code-base

Conversation

Copy link

Copilot AI commented Mar 1, 2026

Timewarrior had no way to configure exclusions on a multi-day cycle (e.g., every alternate Friday), requiring manual per-date entries. This adds off+N / on+N value syntax for exclusions.days.* entries to define a day exclusion recurring every N days from a given start date.

Changes

src/Exclusion.h

  • Added int _period {0} private member

src/Exclusion.cpp

  • Constructor: parses off+N / on+N suffix — strips +N from the token, validates it's a positive integer, stores in _period
  • ranges(): when _period > 0, computes all occurrences within the query range using epoch arithmetic with per-iteration day normalization to handle DST edge cases

test/exclusion.t.cpp

  • 21 new tests: off+14 with start inside range, off+7 with start before range (verifies first-in-range calculation), on+14 additive flag, token normalization

Example

define exclusions:
  days:
    2018_01_05 = off+14   # day off every 2 weeks starting 2018-01-05
    2018_01_05 = on+14    # work day every 2 weeks (overrides holiday)

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 3 commits March 1, 2026 19:27
Co-authored-by: lauft <8539295+lauft@users.noreply.github.com>
Extends the Exclusion class to support a periodic recurrence pattern
for day exclusions. The new "off+N" / "on+N" value syntax means "day
off/on every N days, starting from the given date". This directly
addresses the need to configure exclusions on a 2-week (or any N-day)
cycle.

Example:
  define exclusions:
    days:
      2018_01_05 = off+14  # every 2 weeks starting 2018-01-05

Changes:
- Exclusion.h: add _period member
- Exclusion.cpp: parse +N suffix, generate periodic ranges
- test/exclusion.t.cpp: 21 new tests for periodic exclusion feature

Co-authored-by: lauft <8539295+lauft@users.noreply.github.com>
Co-authored-by: lauft <8539295+lauft@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze code base for exclusions and internal API potential Support periodic day exclusions with off+N/on+N syntax Mar 1, 2026
Copilot finished work on behalf of lauft March 1, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants