jurajmajer / enrico

Enrico Service provides holiday dates for several countries.
MIT License
44 stars 22 forks source link

USA API Call does not return anything. #7

Closed simader closed 2 years ago

simader commented 5 years ago

This API Call does not return anything.

https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForYear&year=2022&country=USA&holidayType=public_holiday

Other Countries are working

jurajmajer commented 5 years ago

Input parameter region is mandatory for USA - see https://kayaposoft.com/enrico/json/

Try this: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForYear&year=2022&country=USA&holidayType=public_holiday&region=dc

I understand meaningful error message is needed here. I'll add it to my TODO list.

simader commented 5 years ago

Thanks for your answer. But why do you not just return all holidays of this country?

For Example for Germany or Great Britainit is working: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForYear&year=2022&country=GER&holidayType=public_holiday

jurajmajer commented 5 years ago

No, not all holidays for the country are returned. Just those holidays are returned which are the same across all regions. So not union but intersection. In USA intersection is simply empty, that is why no holidays are returned.

simader commented 5 years ago

Hello, I just tried to query all regions from USA and there are many holidays intersecting. For Example New Year's Day: image

jurajmajer commented 5 years ago

Yes, but each state has different rules what happens if public holiday falls on Saturday or Sunday. That is why the holidays are not considered to be equal in USA. The rules to calculate common holidays (like New Year's Day, Independence Day etc.) in USA are different across regions. These rules are then part of region-specific code and are not included for the whole country.