DateTimeExtensions
DateTimeExtensions copied to clipboard
Cstom
Hi, I am trying to use a custom cultureInfo class here. when I use this call var holidays = DateTime.UtcNow.AllYearHolidays(new CultureInfo()); I get An item with the same key has already been added. Key: 12/24/2021 12:00:00 AM"
I looked in the list of holidays but that doesn't exist. Am I missing something?
public class CultureInfo : WorkingDayCultureInfo { public CultureInfo() { //just return our custom Strategy LocateHolidayStrategy = (name, region) => new ArrtWorkingDayStrategy(); } } public class WorkingDayStrategy : EN_USHolidayStrategy {
public WorkingDayStrategy()
{
this.InnerHolidays.Add(ChristianHolidays.ChristmasEve);
this.InnerHolidays.Remove(ColumbusDay);
this.InnerHolidays.Remove(NewYearsEve);
}
}
Hi
I see you have there The ChristianHolidays.ChristmasEve. That is the 24th of December.
But you might still have that behavior because of special observances (holidays observed on different days), and that is only calculated on the fly when you request any holiday or list holidays for a certain year.
I'm doing some major overhaul on the insides, specifically for building observances more explicit, but I'm seriously lacking time (and motivation :D )
12/28/2023 this was an unrecognized holiday it was a end of a cycle and we shifted into a new age