Support periodic day exclusions with off+N/on+N syntax#744
Draft
Support periodic day exclusions with off+N/on+N syntax#744
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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+Nvalue syntax forexclusions.days.*entries to define a day exclusion recurring every N days from a given start date.Changes
src/Exclusion.hint _period {0}private membersrc/Exclusion.cppoff+N/on+Nsuffix — strips+Nfrom the token, validates it's a positive integer, stores in_periodranges(): when_period > 0, computes all occurrences within the query range using epoch arithmetic with per-iteration day normalization to handle DST edge casestest/exclusion.t.cppoff+14with start inside range,off+7with start before range (verifies first-in-range calculation),on+14additive flag, token normalizationExample
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.