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
You'll need a datasource for public holiday information.
quick google search gave me: https://www.abstractapi.com/api/holidays-api#:~:text=Abstract%27s%20Public%20Holiday%20API%20is,public%20holidays%20for%20that%20country.
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.
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
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..
yup
thank you for your help! 🙏
yw.
✅ This post has been marked as answered!