Nager.Date icon indicating copy to clipboard operation
Nager.Date copied to clipboard

12/31/1999 US

Open bmarons2 opened this issue 6 years ago • 3 comments

Important specifications

US

Description

Code

            var publicHolidays = DateSystem.GetPublicHoliday("US", 2000);
            foreach (var publicHoliday in publicHolidays)
            {
                Console.WriteLine( publicHoliday.Name + " " + publicHoliday.Date.ToShortDateString());
            }

            Console.WriteLine(   
            DateSystem.IsPublicHoliday(DateTime.Parse("12/31/1999"),CountryCode.US));

Output

New Year's Day 12/31/1999 Martin Luther King, Jr. Day 1/17/2000 Presidents' Day 2/21/2000 Memorial Day 5/29/2000 Independence Day 7/4/2000 Labour Day 9/4/2000 Columbus Day 10/9/2000 Veterans Day 11/10/2000 Thanksgiving Day 11/23/2000 Christmas Day 12/25/2000 False Press any key to continue . . .

12/31/1999 is a public holiday for the year 2000 but when you call IsPublicHoliday(DateTime.Parse("12/31/1999"),CountryCode.US)); it returns false. This is because the Holiday is for the year 2000 not 1999

bmarons2 avatar Jan 30 '19 22:01 bmarons2

I have add a new unit test following countries have an issue MX/PR/US. I'll check that out more closely over the next few days.

tinohager avatar Jan 30 '19 22:01 tinohager

If you are from america? What is the right solution? Add 2 entrys in the calendar?

For example Fr | 30. Dez | New Year's Eve observed Sa | 31. Dez | New Year's Eve

tinohager avatar Jan 31 '19 21:01 tinohager

https://www.law.cornell.edu/uscode/text/5/6103

tinohager avatar Feb 08 '19 21:02 tinohager