Skip to content

Jollyday - A worldwide public holidays library

License

Notifications You must be signed in to change notification settings

mfedkowicz/jollyday

 
 

Repository files navigation

Jollyday Build Status Coverage Crowdin Maven Central

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. The calculation basis of the public holidays for each country is based on a xml file and will be mapped via Jakarta XML Binding. If you already use one of these libraries in your project than just use the specific jollyday dependency.

Maven (click to expand)

Jakarta XML Binding (JAXB)

<dependency>
  <groupId>de.focus-shift</groupId>
  <artifactId>jollyday-jaxb</artifactId>
  <version>${version}</version>
</dependency>
Gradle (click to expand)

Jakarta XML Binding (JAXB)

implementation group: 'de.focus-shift', name: 'jollyday-jaxb', version: '${version}'

Examples

Retrieve public holidays for a year (click to expand)

Returns all german public holidays in 2022

final HolidayManager holidayManager = HolidayManager.getInstance();
final Set<Holiday> holidays = holidayManager.getHolidays(2022, "de");
Retrieve public holidays for a period of days (click to expand)

Returns all german public holidays from the 15th of april in 2022 until the 31st of may in 2023

final HolidayManager holidayManager = HolidayManager.getInstance();
final Set<Holiday> holidays = holidayManager.getHolidays(LocalDate.of(2022, 4, 15), LocalDate.of(2023, 5, 31), "de");
Check if a specific date is a public holiday (click to expand)

Returns true or false if a date is a public holidays in germany.

final HolidayManager holidayManager = HolidayManager.getInstance();
final boolean isHoliday = holidayManager.isHoliday(LocalDate.of(2022, 6, 6), "de");

Returns true or false if a date is a public holidays in Baden-Württemberg in germany.

final HolidayManager holidayManager = HolidayManager.getInstance();
final boolean isHoliday = holidayManager.isHoliday(LocalDate.of(2022, 6, 6), "de", "bw");

Development

If you want to support us at the development on jollyday than take a look at Contributing to jollyday. If you have any kind of questions please go to Discussions and see if there are already answers and if not please open a discussion with your question. If you want to raise an issue or bug you can create a new issue

Requirements

Clone the repository

git clone git@github.com:focus-shift/jollyday.git

Build jollyday

./mvnw clean verify

or for Windows user:

./mvnw.cmd clean verify

License

Apache License, Version 2.0

About

Jollyday - A worldwide public holidays library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%