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

Public holidays in the Netherlands - Liberation Day #64

Closed
sergiu05 opened this issue Nov 16, 2021 · 3 comments
Closed

Public holidays in the Netherlands - Liberation Day #64

sergiu05 opened this issue Nov 16, 2021 · 3 comments

Comments

@sergiu05
Copy link

sergiu05 commented Nov 16, 2021

Hi,

Could you review the implemented rule for Liberation Day - Netherlands?

According with official dutch government and wikipedia sites, Liberation Day is celebrated every year since 1990, and every five years between 1945 and 1989:

@martinjw
Copy link
Owner

Fixed in 2.12. Thanks!

@sergiu05
Copy link
Author

Hello,
Thanks for your fast update.
Small observation:

public static DateTime? LiberationDay(int year)
       {
           if (year < 1990 && year % 5 == 0)
           {
               return new DateTime(year, 5, 5);
           }

           return new DateTime(year, 5, 5);
       }

This will return a DateTime value for all years less than 1990, because the execution flow will reach the second return statement for the years smaller than 1990 non-divisible by 5 (e.g. 1989, 1988).

An updated version:

public static DateTime? LiberationDay(int year)
        {
            if (year >= 1990)
            {
                return new DateTime(year, 5, 5);
            }
            else if (year >= 1945)
            {
                if (year % 5 == 0)
                {
                    return new DateTime(year, 5, 5);
                }
            }
           return null;
        }

Could you have a look?
Thanks again,
S.

@martinjw
Copy link
Owner

Thanks @sergiu05 - updated. I won't do an immediate nuget release - I don't think many people will be looking up calendars that old!

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

2 participants