Giter VIP home page Giter VIP logo

holiday's People

Contributors

anovik avatar bjornsen016 avatar cltw666 avatar fifothehein avatar halling69 avatar hrothval avatar jcdekoning avatar kiruhafighter avatar konradbartecki avatar lucagiorgettismp avatar makaopior avatar martinjw avatar mihaigliga21 avatar mikewuerfel avatar mkrso avatar msboeg avatar olivsoft avatar petergaal avatar rickbeerendonk avatar rlyczynski avatar rsegecin avatar seancallinan avatar seansemerson avatar spetsen avatar stephenherrick avatar stuart-lawrence avatar swannet avatar tossnet avatar vergi40 avatar zimathon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

holiday's Issues

Please add targets for .net standard 2.0 and/or 2.1

Could you add targets for .net standard 2.0 and/or 2.1 for the next release?

I had a .net standard 2.1 library using this package and on the solution using that library I got a lot of NU1605 detected package downgrade errors when publishing, because Holiday package was including old version of NETstandard.library to the build.

I have built the holiday package my self from the source in this repo targeting .net standard 2.1 (and only that, didn't want to install extra SDKs for other targets) and my solution publishes fine with it.

return the name of the holiday

I wonder how we could return the "English" name of the holiday. πŸ€”

For example a new method that would return a list with a date and a name

Family Day in B.C., Canada will be changed starting from 2019

According to the news,

The B.C. government has announced that this year's Family Day will be the last time it falls on the second Monday of February.

Starting in 2019, the holiday will be on the third Monday of February, moving it in line with other provinces in Canada.

Link to the news: https://www.cbc.ca/news/canada/british-columbia/b-c-family-day-moving-one-week-later-starting-in-2019-1.4528735

In CanadaPublicHoliday.cs, we just need to add a simple validation to check if the input year is >= 2019 when province is 'BC'.

Thanks everyone for making this a great project!

Add holiday name information to Holiday object

I'm using the new USAPublicHoliday().GetHolidaysInDateRange(startDate, endDate); function to get the holidays based on our time frame, which isn't 1/1/xxxx - 12/31/xxxx, its more like 2/1 - 1/31.

It requires multiple calls to get the holiday names using new USAPublicHoliday().PublicHolidayNames(year); because it has to run for two years and then do some filtering based on dates.

It would be nice if the name of the holiday was just included on the object returned from the GetHolidaysInDateRange() call.

Great library and project!

Question about non working day that is not a public holiday

I was going to create a patch that add Swedish public holidays. However, it appears that I don't know much about how holidays and days off work in other countries. In Sweden we have two "classes" of holidays:

  1. Public holidays, days off, "red days" in the calendar, usually treated as a Sunday regarding store opening hours and other community services.
  2. Holiday eves, some treated as a Saturday and everyone's off work (Christmas eve, Midsummer eve), other are treated as a week day (MaundyThursday, Epihany eve) but Saturday rules apply in some cases (for example car parking). Depending on your employer different rules apply, about 50% of the workers only work 4 hours.

Since I will be using this library to query if a specific day is on or off work I would need a IsDayOffWork() method rather then the IsPublicHoliday() method.

Would it be ok to add this or perhaps the IsDayOffWork() belongs in another library and this is only for public holidays?

Readme talks about IsBankHoliday() method in IPublicHolidays but it doesn't seem to exist in master? That's probably a more suited method for my case?

Dates that aren't public holidays in DenmarkPublicHoliday

Hello!

I've recently been looking into using this package for determining bank closing days in Scandinavia, but noticed that Denmark is wrong.
Constitution Day and Labour Day are not public holidays in Denmark, but are days off as part of agreement between unions and employers - and very often mutually exclusive.

I would personally remove both days from the class, but this isn't backwards compatible, so I'd like to know how you'd like this change to be made, before I start implementing it (or if you'll do it yourself).

Thanks 😊

Move IPublicHolidays to separate nuget package

Hey, I have a minor issue, where I am building a feature in another public NuGet package that would optionally take IPublicHolidays as parameter.

Right now I would have to reference the whole Holiday package, but I actually only need to reference IPublicHolidays interface.

Would it be possible to move IPublicHolidays to a separate NuGet like Holiday.Interfaces or Holiday.Model?

I assume the main NuGet package Holiday would later depend on this newly created NuGet package.

Incorrect German holidays

I've checked holidays for year 2022 and here are my findings:

June 5th (Pentecost)

  • not returned

November 16th (Repentance and prayer day)

  • library returns November 23rd

September 20th (World's children day)

  • library hardcodes it to September 20th, 2019
if (this.HasWorldChildrensDay(2019))
    dateTimeList.Add(GermanPublicHoliday.WorldChildrensDay(2019));

July 17th (Easter Sunday)

  • not returned

Package version: v2.16.2
Tested method: IList PublicHolidays(int year)

Original dates for observed days

When an observed day (i.e. holidays that are moved because they are on a weekend) is returned would it possible to return the original date as well?

Also, in some locations when a holiday falls on a weekend, it is moved to a weekday as an observed day. In some of these locations only the observed day is considered a holiday whereas in others both the observed and original days are considered holidays. This is an important distinction in some jurisdictions.

Is there any chance of supporting an additional flag against observed holidays that indicate the original day is or isn't a holiday?

NextWorkingDay including current day

Great Library

I was wondering how you would go about solving the following issue.
Given a date, if it's a working day return it, else return the next working day.

EDIT I just looked at the source code, it seems NextWorkingDay should do exactly what I'm after.

I agree with the comment made here:
#5

Suggesting that an overload would be be needed to determine if we would like to include the current date in the check for NextWorkingDay

Nuget package obsolete

Hi,

Thanks for this project. I noted that the package PublicHoliday is up to version 1.3.2.

Any chance you update it with last version 1.4 containing SpainPublicHolidays ?

Thanks

Exception Thrown: AustraliaPublicHoliday

Hi there,

Firstly a great library, but I have a come across an issue while using your library:

Using **Australian Public Holiday** with state **NSW** and Year **2016**

Code

// Get the holidays based on state
var calendar = new AustraliaPublicHoliday { State = AustraliaPublicHoliday.States.NSW };
var result = calendar.PublicHolidayNames(2016);

**Exception: Message: "An item with the same key has already been added. Key: [26/12/2016 12:00:00 AM, Boxing Day]" **

'calendar.PublicHolidayNames(2016)' threw an exception of type 'System.ArgumentException'
    Data: {System.Collections.ListDictionaryInternal}
    HResult: -2147024809
    HelpLink: null
    InnerException: null
    Message: "An item with the same key has already been added. Key: [26/12/2016 12:00:00 AM, Boxing Day]"
    ParamName: null
    Source: "System.Collections"
    StackTrace: "   at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)\r\n   at System.Collections.Generic.SortedDictionary`2.Add(TKey key, TValue value)\r\n   at PublicHoliday.AustraliaPublicHoliday.PublicHolidayNames(Int32 year)"
    TargetSite: {Boolean AddIfNotPresent(T)}

Even though this error shouldn't really be happening, as a first step I think it's important to ensure that the same item can't be added twice.

Can you include state holidays in USAPublicHoliday?

I see that CanadaPublicHoliday takes an argument to determine Province, can there be something similar for American States? Some states don't observe some federal holidays, or observe them on different days than what is currently returned, not to mention all the state-only holidays. See Delaware not celebrating President's Day as an example.

Public Holidays in Germany

Hi,

first of all thanks to your great library.

I have found two problems in german holiday recognition.

  1. Apparently Easter Sunday and Whit Sunday are public holidays in Brandenburg (BB)

  2. Each Sunday is a public holiday in Hessen (HE)

Few new methods

Think these extensions would be useful.

The reverse of the current booleans -

  • IsNotPublicHoliday
  • IsNotBankHoliday
  • IsNotWorkingDay

Get an individual holiday.
Currently there is GetHolidaysInDateRange, i have a use case where im checking an individual date at a time, then add the holiday name to the record if there is a holiday.

Let me know what you think of the above, and if all good i'll look at doing a PR

Canada has added National Day for Truth and Reconciliation, September 30th

National Day for Truth and Reconciliation day is a new paid Federal holiday with the fixed date of September 30th from 2021 onwards.

Not all provinces are observing but federally regulated industries are regardless of province (similar to Remembrance Day). Although, many cities (city employees) in non-observing provinces are observing.

One off 'Day of Mourning' for QEII

Commonwealth countries including the UK, Australia, Canada and New Zealand have announced a one-off 'Day of Mourning' in recognition of the death of Queen Elizabeth II, either falling on the day of her funeral in the UK (19th September 2022) or a day shortly thereafter (22 Sep for Australia, 26 Sep for NZ).

Would it be worth submitting a PR to include these one-off public holidays to allow for users of the library to recognise that these dates are in fact public holidays, or because it's only a one-off in the very near future (and people might not update their libraries quick enough) is it not worth it?

IrelandPublicHoliday considers weekends when it shouldn't

From my understanding the following Public Holidays in Ireland does not move if there is a weekend.

  • New Year's Day (1 January)
  • Saint Patrick's Day (17 March)
  • Christmas Day (25 December)
  • Saint Stephen's Day (26 December)
    Right now IrelandPublicHoliday uses HolidayCalculator.FixWeekend on all of these.

MayDay in Ireland should be the First Monday in May. As of now IrelandPublicHoliday takes 1 May (with weekend fix).

All of the info above is taken from the link below.
https://www.citizensinformation.ie/en/employment/employment-rights-and-conditions/leave-and-holidays/public-holidays/#lc3a51

I can make a PR to fix this if you want to.

Similar Project

Hi Martin

We have a similar project you are interested on a collaboration?

Best regards
Tino

Japan pls

I would like to request Japan's holidays to be included if possible :-)

Exception thrown when getting the holidays for Japan in 2020

When getting the PublicHolidayNames(2020) for Japan, this exception is thrown

An item with the same key has already been added. Key: 5/4/2020 12:00:00 AM

Reason:
ConstitutionMemorialDay(2020) is set to May 3 which is moved to May 4 because May 3 is a Sunday.
GreeneryDay(2020) is already set to May 4 which causes the exception to be thrown

SouthAfricaPublicHoliday - Slightly different rules for FixWeekend

For the SouthAfricaPublicHoliday implementation, the rules in South Africa are slightly different in that only public holidays that fall on a Sunday are carried over to the following Monday. Public holidays that fall on a Saturday do not get observed on another day.

Oh guess what ? Another project on Holidays !

Hi Martin,

The subject oh holidays is very interesting and depth.
In discovering the commenthol project I found the idea very interesting and I wanted to make a C# dll much more rigid and formal, because I am primarily a software developer. I use their data that I format according to my architecture.
I have already started to integrate several (55) countries, the work will be long and tedious.
You did a lot of work on your dll and congratulations!

If you want to take a moment to see, this is my project : https://github.com/Shaenn/ID3iHoliday
You will excuse me, but, I'm French, and the documentation is all in French... ;-)

Best regards Shaenn!

Hacktoberfest

πŸ‘‹ Hello everyone!

πŸŽ‰ We're gearing up for a fantastic Hacktoberfest event at my company this year! As part of our preparations, we're scouting for great open-source projects to contribute to, and we'd like to suggest that repositories participating in Hacktoberfest consider adding the "Hacktoberfest" label to make it easier for contributors to find relevant issues and pull requests. 🏷️

By doing this, you not only encourage us but also many others in the open-source community to get involved in your project. Rest assured, we'll adhere to your project's guidelines and contribute meaningfully.

If your project has specific Hacktoberfest participation guidelines, kindly let us know, and we'll ensure our contributions align with your expectations.

Thanks for considering our request, and we look forward to contributing to your project during this exciting event! πŸ˜„

TimeSpan between 2 dates removing weekends and holidays.

Example test.

        [TestMethod]
        public void TestTimeBetweenDatesRemovingHolidaysAndWeekends()
        {
            // Arrange
            var start = new DateTime(2017, 12, 22, 12, 00, 00);
            var end = new DateTime(2017, 12, 27, 12, 00, 00);

            // Act
            var result = new SwedenPublicHoliday().TimeBetweenDatesWithoutHolidaysAndWeekends(start, end);

            // Assert
            Assert.AreEqual(new TimeSpan(24, 0, 0), result);
        }

AustriaPublicHoliday.IsPublicHoliday

Hello there,

I was about to use your nice and useful lib and did some validation prior to that. I found a little bug:

The following code snippet will print the dates 30.5.2013 and 26.5.2016 (Corpus Christi), which should not happen:

var h = new AustriaPublicHoliday();

for (int year = 2010; year < 2018; year++)
{
    var days = h.PublicHolidays(year);
    var fd = days.Where(d => !h.IsPublicHoliday(d));

    if (fd.Any())
        Console.WriteLine(string.Join(Environment.NewLine, fd));
}

Wouldn't it be easier to use the PublicHolidays list to check against a single date in the IsPublicHolday method?

Best regards,
Oliver

Exception thrown when getting the holidays for Turkey in 2023

When getting the PublicHolidayNames(2023) for Turkey, this exception is thrown:
An item with the same key has already been added. Key: 4/23/2023 12:00:00 AM

Reason:
Because National Sovereignty and Children's Day coincides with the 3rd day of Ramadan Feast.

Error on AustriaPublicHoliday.PublicHolidays(2008)

Error in Line: bHols.Add(Ascension(easter), "Christi Himmelfahrt"); -> An element with the same key has already been added.
In the Year 2008 is "Staatsfeiertag" and "Christi Himmelfahrt" on the same date 1.5.2008 !

Optimize Easter calculation

In HolidayCalculator.cs the current code calculates the day and month and then assigns it to a new DateTime. It is a complex calculation for retrieving the day and month value while the DateTime stores it as a day counter

Current code:

            var g = year % 19;
            var c = year / 100;
            var h = (c - c / 4 - (8 * c + 13) / 25 + 19 * g + 15) % 30;
            var i = h - (h / 28) * (1 - (h / 28) * (29 / (h + 1)) * ((21 - g) / 11));
            var j = (year + year / 4 + i + 2 - c + c / 4) % 7;
            var p = i - j;
            var easterDay = 1 + (p + 27 + (p + 6) / 40) % 31;
            var easterMonth = 3 + (p + 26) / 30;

            return new DateTime(year, easterMonth, easterDay);

Instead this code could be used and works (tested). The variable l is an offset value in days and can be applied directly to AddDays on DateOnly or DateTime

       var century = year / 100;
       var n = year % 19;
       var h = (century - century / 4 - (8 * century + 13) / 25 + 19 * n + 15) % 30;
       var i = h - h / 28 * (1 - h / 28 * (29 / (h + 1)) * ((21 - n) / 11));
       var j = year + year / 4 + i + 2 - century + century / 4;
       var l = i - j % 7;

       return new DateTime(year, 3, 28).AddDays(l);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.