Class DateRolls

java.lang.Object
org.holiday.calendar.function.DateRolls

public final class DateRolls extends Object
Factory providing common DateRoll strategies.
Author:
Dave Joyce
  • Method Details

    • noRoll

      public static DateRoll noRoll()
      No adjustment — returns the date unchanged.
    • previousFridayOrFollowingMonday

      public static DateRoll previousFridayOrFollowingMonday()
      Saturday rolls back to Friday; Sunday rolls forward to Monday.
    • followingMonday

      public static DateRoll followingMonday()
      Saturday and Sunday both roll forward to Monday.
    • sundayToMonday

      public static DateRoll sundayToMonday()
      Only Sunday rolls forward to the following Monday; Saturday is returned unchanged (no substitute observance).

      Implements the Japanese substitute-holiday rule (振替休日): Article 3, paragraph 2 of the Act on National Holidays (国民の祝日に関する法律, 1948, amended 2007) creates a make-up Monday only when a national holiday falls on Sunday. A Saturday holiday has no substitute — it falls on an already- closed day and is returned at its natural date.

      See Also:
    • followingSunday

      public static DateRoll followingSunday()
      Friday and Saturday both roll forward to Sunday.

      Implements the GCC market rule (Saudi Arabia, UAE, Kuwait, Bahrain, Oman): the weekend is Friday + Saturday; Sunday is the first business day of the week.

      See Also:
    • previousThursdayOrFollowingSunday

      public static DateRoll previousThursdayOrFollowingSunday()
      Friday rolls back to Thursday; Saturday rolls forward to Sunday.

      Implements the Qatar national holiday substitute rule as announced by the Amiri Diwan: when a public holiday falls on Friday (the first weekend day), it is observed on the preceding Thursday; when it falls on Saturday (the second weekend day), it is observed on the following Sunday.

      Confirmed precedents: Qatar National Day 2020 (18 Dec = Friday → 17 Dec Thursday official); Qatar National Day 2021 (18 Dec = Saturday → 19 Dec Sunday official).

      See Also:
    • compose

      public static DateRoll compose(DateRoll first, DateRoll second)
      Compose two rolls: apply first, then apply second.