- java.lang.Object
-
- de.focus_shift.jollyday.core.util.CalendarUtil
-
public class CalendarUtil extends Object
Utility class for date operations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancontains(Set<Holiday> holidays, LocalDate date)Shows if the requested date is contained in the Set of holidays.static booleancontains(Set<Holiday> holidays, LocalDate date, HolidayType holidayType)Shows if the requested date is contained in the Set of holidays.static LocalDatecreate()Creates the current date within the gregorian calendar.static LocalDatecreate(int year, int month, int day)Creates the date within the ISO chronology.static ChronoLocalDatecreate(int year, int month, int day, Chronology chronology)Creates the date within the provided chronology.static Stream<LocalDate>getEthiopianOrthodoxHolidaysInGregorianYear(int gregorianYear, int eoMonth, int eoDay)Returns a set of gregorian dates within a gregorian year which equal the ethiopian orthodox month and day.static Stream<LocalDate>getIslamicHolidaysInGregorianYear(int gregorianYear, int islamicMonth, int islamicDay)Returns a set of gregorian dates within a gregorian year which equal the islamic month and day.static Set<LocalDate>getRelativeIslamicHolidaysInGregorianYear(int gregorianYear, int islamicMonth, int islamicDay, int relativeShift)Returns a set of gregorian dates within a gregorian year which equal the islamic month and day with a relative shift.static booleanisWeekend(LocalDate date)Returns if this date is on a wekkend.
-
-
-
Method Detail
-
create
public static LocalDate create()
Creates the current date within the gregorian calendar.- Returns:
- today
-
create
public static LocalDate create(int year, int month, int day)
Creates the date within the ISO chronology.- Parameters:
year- a int.month- a int.day- a int.- Returns:
- date
-
create
public static ChronoLocalDate create(int year, int month, int day, Chronology chronology)
Creates the date within the provided chronology.- Parameters:
year- a int.month- a int.day- a int.chronology- the chronology to use- Returns:
- date the
LocalDate
-
isWeekend
public static boolean isWeekend(LocalDate date)
Returns if this date is on a wekkend.- Parameters:
date- aLocalDateobject.- Returns:
- is weekend
-
getIslamicHolidaysInGregorianYear
public static Stream<LocalDate> getIslamicHolidaysInGregorianYear(int gregorianYear, int islamicMonth, int islamicDay)
Returns a set of gregorian dates within a gregorian year which equal the islamic month and day. Because the islamic year is about 11 days shorter than the gregorian there may be more than one occurrence of an islamic date in an gregorian year. i.e.: In the gregorian year 2008 there were two 1/1. They occurred on 1/10 and 12/29.- Parameters:
gregorianYear- a int.islamicMonth- a int.islamicDay- a int.- Returns:
- List of gregorian dates for the islamic month/day.
-
getRelativeIslamicHolidaysInGregorianYear
public static Set<LocalDate> getRelativeIslamicHolidaysInGregorianYear(int gregorianYear, int islamicMonth, int islamicDay, int relativeShift)
Returns a set of gregorian dates within a gregorian year which equal the islamic month and day with a relative shift. Because the islamic year is about 11 days shorter than the gregorian there may be more than one occurrence of an islamic date in an gregorian year. i.e.: In the gregorian year 2008 there were two 1/1. They occurred on 1/10 and 12/29.- Parameters:
gregorianYear- a int.islamicMonth- a int.islamicDay- a int.relativeShift- a int.- Returns:
- List of gregorian dates for the islamic month/day shifted by relative shift days.
-
getEthiopianOrthodoxHolidaysInGregorianYear
public static Stream<LocalDate> getEthiopianOrthodoxHolidaysInGregorianYear(int gregorianYear, int eoMonth, int eoDay)
Returns a set of gregorian dates within a gregorian year which equal the ethiopian orthodox month and day. Because the ethiopian orthodox year different from the gregorian there may be more than one occurrence of an ethiopian orthodox date in an gregorian year.- Parameters:
gregorianYear- a int.eoMonth- a int.eoDay- a int.- Returns:
- List of gregorian dates for the ethiopian orthodox month/day.
-
contains
public static boolean contains(Set<Holiday> holidays, LocalDate date)
Shows if the requested date is contained in the Set of holidays. Calls #contains(holidays, date, null)- Parameters:
holidays- the holidays to search throughdate- the date to look for- Returns:
- the date is contained in the set of holidays
-
contains
public static boolean contains(Set<Holiday> holidays, LocalDate date, HolidayType holidayType)
Shows if the requested date is contained in the Set of holidays.- Parameters:
holidays- aSetobject.date- aLocalDateobject.holidayType- aHolidayTypeobject- Returns:
- contains this date
-
-