Business Calendars API

BusinessCalendarRepository

BusinessCalendarRepository defines convenient methods to fetch business calendars configured in the system.

  • The getBusinessCalendarByCode() method returns the business calendar with provided code.

  • The getAllBusinessCalendars() method returns all business calendars configured in the system.

BusinessCalendar

BusinessCalendar provides methods for checking if a given date and time is within working hours, and for arithmetic operations with date and time considering the business hours defined by the calendar:

  • isBusinessDay(LocalDate date) checks if provided date belongs to business days.

  • isBusinessTime(LocalDateTime dateTime) method checks if provided date and time belongs to business time.

  • plus(LocalDate date, int daysToAdd) returns a copy of provided date with the specified amount of business days added.

  • minus(LocalDate date, int daysToSubtract) returns a copy of provided date with the specified amount of business days subtracted.

  • plus(LocalDateTime dateTime, int hoursToAdd) returns a copy of provided date and time with the specified amount of business hours added.

  • minus(LocalDateTime dateTime, int hoursToSubtract) returns a copy of provided date and time with the specified amount of business hours subtracted.

  • plus(LocalDateTime dateTime, Duration duration) returns a copy of provided date-time with the specified duration in terms of working time added.

  • minus(LocalDateTime dateTime, Duration duration) returns a copy of provided date-time with the specified duration in terms of working time subtracted.