Add external holiday data provider support via holidays.provider#743
Draft
Add external holiday data provider support via holidays.provider#743
holidays.provider#743Conversation
Co-authored-by: lauft <8539295+lauft@users.noreply.github.com>
- Move createHolidayMap() from CmdChart.cpp to data.cpp - Move renderHolidays() free function from CmdSummary.cpp to data.cpp - Declare both in timew.h alongside existing getHolidays() - Have Chart::renderHolidays() delegate to the shared free function - Remove cross-file forward declaration from CmdSummary.cpp - Remove duplicate renderHolidays() from CmdSummary.cpp - Remove createHolidayMap() definition from CmdChart.cpp - Add build/ to .gitignore 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 holiday data usage in Timewarrior
Encapsulate holiday data retrieval and rendering in internal API
Mar 1, 2026
Co-authored-by: lauft <8539295+lauft@users.noreply.github.com>
Copilot
AI
changed the title
Encapsulate holiday data retrieval and rendering in internal API
Add external holiday data provider support via Mar 1, 2026
holidays.provider
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.
Holiday data is currently only readable from the config file. This adds an encapsulated API hook so an external tool can supply holiday data instead, enabling dynamic/third-party holiday sources.
Changes
src/data.cppgetHolidayEntriesFromProvider(provider, range)— new static helper; invokes the configured tool as<tool> YYYY-MM-DD YYYY-MM-DD, parses JSON Lines output into(Datetime, name)pairs; malformed lines are silently skippedgetHolidays(const Rules&, const Range&)— new range-aware overload; delegates to the provider when configured, falls back to config-file data otherwisegetAllExclusions()— updated to call the range-awaregetHolidaysso provider holidays feed into the gaps/exclusions enginecreateHolidayMap()— updated to use the provider whenholidays.provideris setgetHolidays(rules)(no-range) — hardened to skip theholidays.providerkey and catch date-parse errors from unexpected config entriessrc/timew.hgetHolidays(const Rules&, const Range&)overloadtest/holidays.t(new)summary, provider overrides config holidays, config holidays work without a provider, date range passed as CLI args, malformed JSON lines skippedUsage
The tool is invoked as:
Each line of output must be a JSON object:
{"date":"2025-01-01","name":"New Year's Day"}When
holidays.provideris set, config-file holiday entries (holidays.<locale>.<date>) are ignored entirely.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.