C
C#2y ago
joy

get public holiday of a country [Answered]

hi all, how do we check if a specific date is a public holiday in a country using c#? i try to use https://github.com/nager/Nager.Date nager package but it's only for people who sponsor this bcs a license is needed, there's a public api that we can use, but only limited to check if today is a public holiday, not to check if specific date is a holiday, can anybody help to advise? thank you so much in advance
8 Replies
Pobiega
Pobiega2y ago
You'll need a datasource for public holiday information.
Pobiega
Pobiega2y ago
Free Public Holidays API - 200+ countries & regions
Free API to get the official bank and public holidays for 200+ countries, states, and provinces for 100+ years. Get your free API key to start today.
Pobiega
Pobiega2y ago
Also, the nager API seems just fine? https://date.nager.at/api/v3/PublicHolidays/2022/SE you specify year and country and you get all public holidays for that year
joy
joy2y ago
i was trying to check for a specific date range, for example if from 24 September 2022 - 28 October 2022 there's any public holiday, but after thinking for a while, i think it's better to get all public holidays of the year rather than calling an api several times..
Pobiega
Pobiega2y ago
yup
joy
joy2y ago
thank you for your help! 🙏
Pobiega
Pobiega2y ago
yw.
Accord
Accord2y ago
✅ This post has been marked as answered!