Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holiday.HolidayDate is returning ObservedDate and not the "Original" date. #76

Open
FifoTheHein opened this issue Sep 26, 2022 · 3 comments

Comments

@FifoTheHein
Copy link
Contributor

Holiday.HolidayDate is returning ObservedDate and not the "Original" date. When checking all holidays that fall over weekends, Holiday.HolidayDate and Holiday.ObservedDate are always the same (i.e. they both return the observed date)

@martinjw
Copy link
Owner

Only implemented properly for USA + Canada. The other countries still need to be done.

@GrapeJuice787
Copy link

Does this mean that the functionality works for the US now? If so, which function call is to be used?

@martinjw
Copy link
Owner

            var actual = USAPublicHoliday.NewYear(2023);
            Assert.AreEqual(new DateTime(2023, 1, 2), actual.ObservedDate, "1st January is Sunday, so observed on Monday");
            Assert.AreEqual(new DateTime(2023, 1, 1), actual.HolidayDate, "1st January is Sunday, available on Holiday date");
            Assert.AreEqual(new DateTime(2023, 1, 2), actual, "Implicit conversion to observed date");
            //list of holidays
            var hols = new USAPublicHoliday().PublicHolidaysInformation(2023);
            var newYear = hols.First();
            Assert.AreEqual(new DateTime(2023, 1, 2), newYear.ObservedDate, "1st January is Sunday, so observed on Monday");
            Assert.AreEqual(new DateTime(2023, 1, 1), newYear.HolidayDate, "1st January is Sunday, available on Holiday date");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants