Closed MoriTanosuke closed 7 years ago
Hi, generally the holiday API i working with holiday calendar XML files. There are a couple of examples which basically assemble holidays of a specific country. But this does not have be a country. There is also a holiday calendar named 'nyse' which has a list of holidays for the New York Stock Exchange. You can create your own XML file, put it in your apps classpath and use it with the API. Cheers, Sven
I already asked this question on StackOverflow, but already got a comment that the question might be offtopic... I hope this is the right place to ask this.
In my application the user can set her
Locale
from a list of available locales. The application then needs to determine if a given date is a holiday.Here is my current code:
I can change this to the following code to set a specific
HolidayCalendar
:But this method is deprecated and I would need to figure out which
HolidayCalendar
I need based on the user locale. What I want to do is something like this:I know that
HolidayManager
is usingLocale.getDefault()
and there are public methods inHoliday
too (see here) but I can not figure out how to do this and the documentation is very brief.My question: Can I get the holidays based on a particular locale? Do I have to write a major
switch
statement for all the locales to match aHolidayCalendar
?