WorldHolidayDates
This project provides the dates and times of holidays around the world, specifically 168 countries. The data is taken from the processed holidays.json
from date-holidays. Any interests in contributing to the holiday database should be made there, since this project is just a Java implementation to get data from it.
This project is still under construction.
Usage
Initialize the holiday data as soon as possible in your project:
HolidayData holidayData = HolidayData.initializeData();
Get a Country
which contains its national holidays along with the holidays of its regions and states using its 2-character country code (you can look up the code for specific countries here):
Country vietnam = holidayData.getCountry("VN");
To get holiday data from a Country
object, use:
List<Holiday> holidays = vietnam.getDays();
To calculate the date and name (in English) of a Holiday
in a certain year
, use:
Holiday h = holidays.get(0);
LocalDate date = h.calculateDate(2021);
LocalDateTime dateTime = h.calculate(2021);
String hNameInEnglish = h.getName().get("en");
To get a list of LocalDate
or LocalDateTime
of holiday in a certain year
, use:
List<LocalDateTime> holidaysList = vietnam.getHolidaysList(2021);
List<LocalDate> holidays = vietnam.getHolidaysDatesList(2021);
Building
The project uses gradle for building. Standard gradle tasks for the java plugin can be found here. They can be invoked on the command line by running gradlew
or gradlew.bat
with the name of the task, for example gradlew jar
to create the jar archive.
Testing
TBU