Table of Contents

INotableDateService Interface

Definition

Namespace
Bodu.Globalization.Calendar
Assembly
Bodu.Globalization.Calendar.dll
Package
Bodu.Globalization.Calendar 1.0.1
Source
INotableDateService.cs

Resolves notable-date occurrences - public holidays, observances, and other named dates - for a requested territory and a single day or an inclusive date range.

public interface INotableDateService
Extension Methods

Examples

// Resolve a service over a country's bundled rules.
INotableDateService service = AmericasCalendarData.CreateService("US");

// Every notable date emitted on a single day.
IReadOnlyList<NotableDate> newYear = service.Resolve(new DateOnly(2026, 1, 1), "US");

// Non-working public holidays across a whole year, restricted by a filter.
NotableDateFilter holidays = NotableDateFilter
    .ForCategory(NotableDateCategory.PublicHoliday)
    .And(NotableDateFilter.IsNonWorkingDay());

DateRange year = new(new DateOnly(2026, 1, 1), new DateOnly(2026, 12, 31));
IReadOnlyList<NotableDate> publicHolidays = service.Resolve(year, "US", holidays);

Remarks

An implementation draws its occurrences from a loaded NotableDateResource and applies the resource's resolution policy: it calculates each rule's actual date, places any observed (substitute) date, resolves same-day collisions, and emits the surviving NotableDate occurrences. The canonical implementation is NotableDateService.

Territory. The territory argument is a country code (US) or a subdivision ( CA-ON, AU-NSW). A subdivision sees both its own rules and the broader rules of its parent country, with the most specific rule winning for a shared concept.

Inclusion by emitted date. An occurrence is included when its emitted (observed) date falls on the requested day or within the requested range, so a single-day query and a range query covering the same dates return consistent results.

When to use. Resolve a service from a data pack (for example the AmericasCalendarData bundle) or from a document loaded with NotableDateResourceLoader, then query it directly; or call the working-day extension methods in Bodu.Extensions (such as IsWorkingDay / NextWorkingDay), which delegate to this surface.

Methods

GetSupportedCalendars()

Gets the distinct calendar systems any rule in the resource is expressed in.

IReadOnlyList<CalendarSystem> GetSupportedCalendars()

Returns

IReadOnlyList<CalendarSystem>

The calendar systems in use, in ascending order.

GetSupportedTerritories()

Gets the distinct territories any rule in the resource is scoped to.

IReadOnlyList<string> GetSupportedTerritories()

Returns

IReadOnlyList<string>

The scoped territory codes in case-insensitive ascending order; empty when every rule is global (unscoped).

Resolve(DateRange, string)

Resolves the notable-date occurrences emitted within an inclusive date range for the requested territory.

IReadOnlyList<NotableDate> Resolve(DateRange range, string territory)

Parameters

range DateRange

The inclusive range of days to resolve.

territory string

The requested territory code.

Returns

IReadOnlyList<NotableDate>

The occurrences whose emitted date falls within the range, ordered by date then identity.

Resolve(DateRange, string, NotableDateFilter)

Resolves the notable-date occurrences emitted within an inclusive date range for the requested territory, restricted to those matching the supplied filter.

IReadOnlyList<NotableDate> Resolve(DateRange range, string territory, NotableDateFilter filter)

Parameters

range DateRange

The inclusive range of days to resolve.

territory string

The requested territory code.

filter NotableDateFilter

The filter that emitted occurrences must satisfy.

Returns

IReadOnlyList<NotableDate>

The matching occurrences, ordered by date then identity.

Resolve(DateOnly, string)

Resolves the notable-date occurrences emitted on a single day for the requested territory.

IReadOnlyList<NotableDate> Resolve(DateOnly date, string territory)

Parameters

date DateOnly

The day to resolve.

territory string

The requested territory code.

Returns

IReadOnlyList<NotableDate>

The occurrences whose emitted date equals date; empty when there are none.

Resolve(DateOnly, string, NotableDateFilter)

Resolves the notable-date occurrences emitted on a single day for the requested territory, restricted to those matching the supplied filter.

IReadOnlyList<NotableDate> Resolve(DateOnly date, string territory, NotableDateFilter filter)

Parameters

date DateOnly

The day to resolve.

territory string

The requested territory code.

filter NotableDateFilter

The filter that emitted occurrences must satisfy.

Returns

IReadOnlyList<NotableDate>

The matching occurrences; empty when there are none.

Applies to

ProductVersions
.NET8, 10

See Also