- java.lang.Object
-
- de.focus_shift.jollyday.core.util.CalendarUtil
-
public class CalendarUtil extends Object
Utility class for date operations.- Version:
- $Id: $
- Author:
- Sven Diedrichsen
-
-
Constructor Summary
Constructors Constructor Description CalendarUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Set<Holiday> holidays, LocalDate date)Calls #contains(holidays, date, null)booleancontains(Set<Holiday> holidays, LocalDate date, HolidayType holidayType)Shows if the requested date is contained in the Set of holidays.LocalDatecreate()Creates the current date within the gregorian calendar.LocalDatecreate(int year, int month, int day)Creates the date within the ISO chronology.ChronoLocalDatecreate(int year, int month, int day, Chronology chronology)Creates the date within the provided chronology.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.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.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.booleanisWeekend(LocalDate date)Returns if this date is on a wekkend.
-
-
-
Method Detail
-
create
public LocalDate create()
Creates the current date within the gregorian calendar.- Returns:
- today
-
create
public 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 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 boolean isWeekend(LocalDate date)
Returns if this date is on a wekkend.- Parameters:
date- aLocalDateobject.- Returns:
- is weekend
-
getIslamicHolidaysInGregorianYear
public 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 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 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 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
-
-