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

Use ISO 3166-2 to identify the country and the subdivisions #388

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Jollyday is a java library to query public holidays. Currently, we support **over 70 countries**.

Thanks to @svendiedrichsen who started jollyday!

## How to use it

**Jollyday** is based on **Java 11** and can be used directly as dependency via maven or gradle e.g.
Expand Down Expand Up @@ -167,6 +165,19 @@ If you already use one of these libraries in your project than just use the spec
```
</details>

## ISO 3166

To retrieve the public holidays of a country the [ISO 3166-1 alpha-2] standard is used. An [list of current ISO 3166-1 alpha-2 codes] is available at wikipedia.

To access the public holidays of a subdivision of a country, e.g. Baden-Württemberg of Germany the [ISO 3166-2] standard is used. A [list of current ISO 3166-2 codes] is available at wikipedia.

### Data precision

| Precision | Supported |
|--------------------------------|-----------|
| Country ([ISO 3166-1 alpha-2]) | Yes |
| Subdivisions ([ISO 3166-2]) | Yes |
| City Holiday | Yes |

## Development

Expand Down Expand Up @@ -201,3 +212,7 @@ or for Windows user:
[Apache License, Version 2.0](LICENSE.md)

[Discussions]: https://github.com/focus-shift/jollyday/discussions
[ISO 3166-1 alpha-2]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
[list of current ISO 3166-1 alpha-2 codes]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Current_codes
[ISO 3166-2]: https://en.wikipedia.org/wiki/ISO_3166-2
[list of current ISO 3166-2 codes]: https://en.wikipedia.org/wiki/ISO_3166-2#Current_codes
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/**
* This enum provides a list of all supported holiday calendars.
*
* @author Sven Diedrichsen ([email protected])
* @version $Id$
*/
public enum HolidayCalendar {
Expand Down Expand Up @@ -47,5 +46,4 @@ public enum HolidayCalendar {
public String getId() {
return id;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ public String getCountryDescription(Locale l, String key) {
* @return 2-digit ISO codes.
*/
public Set<String> getISOCodes() {
Set<String> codes = new HashSet<>();
ResourceBundle countryDescriptions = getCountryDescriptions(Locale.getDefault());
final Set<String> codes = new HashSet<>();
final ResourceBundle countryDescriptions = getCountryDescriptions(Locale.getDefault());
for (String property : Collections.list(countryDescriptions.getKeys())) {
String[] split = property.split("\\.");
final String[] split = property.split("\\.");
if (split.length > 2) {
codes.add(split[2].toLowerCase());
}
Expand Down
Loading