V6 introduces a few breaking changes. These are biproduct of the need to also register non holidays days, like special observable days.
This means that most of the types have migrated from Holiday to Observance, which then expose a boolean property for IsHoliday.
This version also splits the responsability of resolving the day in the year of the observable day into Resolver implementations. Named days are now build with composition of the resolver rather than inheriting them.
v5 |
v6 |
Breaking change |
|---|---|---|
Holiday |
NamedDay |
Holiday is no longer the base abstraction. Consumer code that referenced or derived from Holiday must move to NamedDay. Construction also changes from inheritance to composition: NamedDay is created with IDayResolver. |
YearMapHoliday |
YearMapNamedDay |
Type rename. Any direct construction or type checks against YearMapHoliday will break. |
Rule-based Holiday types |
IDayResolver implementations |
Date-calculation behavior has been extracted into resolver types. Custom calendar types built by subclassing Holiday now need to be modeled as NamedDay + IDayResolver. |
| n/a | Observance |
Holiday-facing APIs now expose Observance instead of Holiday. The day definition is carried in Observance.CalendarDay, and holiday status is now explicit through Observance.IsHoliday. |
v5 |
v6 |
Breaking change |
|---|---|---|
IHolidayStrategy |
IObservancesStrategy |
Interface rename. Implementations must switch from IEnumerable<Holiday> to IEnumerable<Observance>, and rename members from Holidays / GetHolidaysOfYear to Observances / GetObservancesOfYear. |
IWorkingDayCultureInfo.Holidays |
IWorkingDayCultureInfo.Observances |
Property rename and element type change from Holiday to Observance. |
IWorkingDayCultureInfo.GetHolidaysOfYear(int) |
IWorkingDayCultureInfo.GetObservancesOfYear(int) |
Method rename and return type change from IEnumerable<Holiday> to IEnumerable<Observance>. |
Func<string, string, IHolidayStrategy> hooks |
Func<string, string, IObservancesStrategy> hooks |
Custom locator/dependency-injection code that plugs holiday strategies into WorkingDayCultureInfo must update to the new interface. |
| n/a | IDayResolver |
New public interface required by NamedDay. On this branch it is declared in the global namespace, so code should not expect DateTimeExtensions.WorkingDays.IDayResolver. |
DateTime.AllYearHolidays(...)now returnsIDictionary<DateTime, Observance>instead ofIDictionary<DateTime, Holiday>.DateTimeOffset.AllYearHolidays(...)now returnsIDictionary<DateTimeOffset, Observance>instead ofIDictionary<DateTimeOffset, Holiday>.Holiday.ResourceManagerbecomesNamedDay.ResourceManager, and the default resource base changes fromHolidayNamestoDayNames. Any custom localization code tied to the old type or resource name must be updated.