Bodu.Globalization.Calendar
1.3.0
dotnet add package Bodu.Globalization.Calendar --version 1.3.0
NuGet\Install-Package Bodu.Globalization.Calendar -Version 1.3.0
<PackageReference Include="Bodu.Globalization.Calendar" Version="1.3.0" />
<PackageVersion Include="Bodu.Globalization.Calendar" Version="1.3.0" />
<PackageReference Include="Bodu.Globalization.Calendar" />
paket add Bodu.Globalization.Calendar --version 1.3.0
#r "nuget: Bodu.Globalization.Calendar, 1.3.0"
#:package Bodu.Globalization.Calendar@1.3.0
#addin nuget:?package=Bodu.Globalization.Calendar&version=1.3.0
#tool nuget:?package=Bodu.Globalization.Calendar&version=1.3.0
Bodu.Globalization.Calendar
API stability - Stable. The public API surface is committed: breaking changes are reserved for a major-version bump per SemVer, except a deliberate break that is recorded in the release notes and in the package's
CompatibilitySuppressions.xml. See versioning and support.
A resource-driven notable-date (holiday / observance) engine for .NET 8 and .NET 10. Calendars are described as declarative, importable documents - concepts, rules, calculation strategies, adjustment policies, and resolution policies - that the engine resolves into concrete occurrences for a territory and date range. The package ships the calculation strategies, astronomical algorithms, range-resolution machinery, and working-day extensions; the regional holiday data ships in the companion Bodu.Globalization.Calendar.<Region> data packages.
Installation
dotnet add package Bodu.Globalization.Calendar
Targets net8.0 and net10.0.
Core model
| Type | Summary |
|---|---|
NotableDateService / INotableDateService |
Stateless resolver that computes occurrences from a loaded resource over a date range, applying filters and resolution policy |
NotableDateResource / NotableDateResourceLoader |
Immutable validated document and its loader (resolves imports, validates the schema, binds custom algorithms) |
NotableDateDefinition |
A notable-date concept: stable id, display name, inherited defaults, and child rules |
NotableDateRule |
One calculation method for a concept: applicability scope, strategy, and adjustment policies |
NotableDate |
A resolved occurrence: actual vs. observed date, category, priority, duration, working-day flags |
NotableDateFilter |
Composable immutable predicate over resolved occurrences (category, tag, name, duration, observed state) |
TerritoryCode |
Validated ISO 3166-1 country with optional ISO 3166-2 subdivision and parent/child containment |
Shared faith and civil catalogues (global-core, christian-western, christian-orthodox, catholic, global-islamic, global-jewish, global-buddhist, global-hindu, global-persian, …) are embedded in this core library and resolved through CommonNotableDateResources; the regional data packs import them via their region hubs.
Calculation strategies and algorithms
The Bodu.Globalization.Calendar.Algorithms namespace provides the IDateCalculationStrategy implementations - among them FixedDateStrategy, DayOfWeekInMonthStrategy, RelativeWeekdayInMonthStrategy, WeekdayNearDateStrategy, OffsetFromRuleStrategy, and AlgorithmDateStrategy. AlgorithmDateStrategy dispatches an <Algorithm key> to the bundled astronomical and calendrical calculators (Easter, the equinoxes and solar terms, lunar phases, the Hindu lunisolar festivals, Losar, and the gazetted Matariki table), which are internal and reached only through their keys. Custom algorithms implement INotableDateAlgorithm, register through NotableDateAlgorithmRegistry, and dispatch by key.
Range resolution
The Bodu.Globalization.Calendar.RangeResolution namespace defines how colliding occurrences collapse: ResolutionPolicy carries the duplicate policy the loader applies to a document's own declarations (DuplicatePolicy), the same-day and span collision and priority-direction rules (CollisionPolicy, PriorityDirection), the span that controls range inclusion (ObservedDateRangePolicy), the category precedence, and the working week, with INotableDateCollisionResolver as the custom extension point; each AdjustmentPolicy carries its own EmissionMode.
Working-day extensions
The Bodu.Extensions namespace adds working-day and notable-date helpers over DateOnly, DateTime, and DateTimeOffset:
using Bodu.Extensions;
bool isHoliday = date.IsNotableDate(service, territory);
DateOnly settle = date.AddWorkingDays(2, service, territory);
DateOnly next = date.NextWorkingDay(service, territory);
Members include IsWorkingDay, IsWeekend, AddWorkingDays, NextWorkingDay / PreviousWorkingDay, SnapToWorkingDay, WorkingDaysBetween, the IsNotableDate / GetNotableDates / EnumerateNotableDates family, and fiscal-period helpers.
Related packages
| Package | Purpose |
|---|---|
Bodu.Globalization.Calendar.<Region> |
Per-country holiday data bundles (Americas, AsiaPacific, Europe, MiddleEast, Africa) |
Bodu.Globalization.Calendar.Builder |
Fluent API for authoring notable-date documents |
Bodu.Globalization.Calendar.Plugins |
Trust-gated loading of external algorithm plugins |
Bodu.Globalization.Calendar.DependencyInjection |
IServiceCollection registration |
Building and testing
To build this package from source and run its tests, see CONTRIBUTING.md. The published vectors and corpora the tests hold it to are listed under conformance and test vectors.
Runnable samples
The repository ships offline, dotnet run-able sample projects for the calendar packages - holiday queries with subdivision shadowing, working-day arithmetic, authored company calendars, DI with live data reload, and custom algorithms with contract tests - under samples/Globalization.Calendar/.
License
MIT. © Bodu Pty. Ltd.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Bodu.Core (>= 1.3.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
-
net8.0
- Bodu.Core (>= 1.3.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
NuGet packages (11)
Showing the top 5 NuGet packages that depend on Bodu.Globalization.Calendar:
| Package | Downloads |
|---|---|
|
Bodu.Globalization.Calendar.Caching
Caching layer for Bodu.Globalization.Calendar. Provides CachingNotableDateService, a decorator that wraps any INotableDateService and serves computed notable dates from a per-territory, per-civil-year cache (in-memory or one TOML/JSON file per territory), recording when each year was computed and refreshing on a configurable time-to-live or a resource-version change. Includes the dependency-injection registration (AddCachedNotableDateService) on IServiceCollection. |
|
|
Bodu.Globalization.Calendar.AsiaPacific
Notable-date resource pack for Bodu.Globalization.Calendar covering the Asia-Pacific region (Australia, China, Japan, New Zealand), built on the notable-date schema. Exercises the Gregorian, Chinese lunisolar, equinox, lunar-phase, and gazetted-table strategies through the AsiaPacificCalendarData factory. |
|
|
Bodu.Globalization.Calendar.Americas
Notable-date resource pack for Bodu.Globalization.Calendar covering the Americas region (Canada, United States), built on the notable-date schema. Each territory is a self-contained embedded resource exposed through the AmericasCalendarData factory. |
|
|
Bodu.Globalization.Calendar.Builder
Fluent, chainable C# API for authoring Bodu.Globalization.Calendar notable-date documents on the notable-date schema, with full XML serialization and a JSON-subset surface for load and save. |
|
|
Bodu.Globalization.Calendar.MiddleEast
Notable-date resource pack for Bodu.Globalization.Calendar covering the Middle East (United Arab Emirates, Saudi Arabia, Israel, Turkey, Qatar, Jordan), built on the notable-date schema. Exercises the tabular and Umm al-Qura Hijri, Hebrew, and Friday/Saturday working-week conventions through the MiddleEastCalendarData factory. |
GitHub repositories
This package is not used by any popular GitHub repositories.