Class ChristmasEveEarlyClose

java.lang.Object
org.holiday.calendar.observance.AbstractObservance
org.holiday.calendar.observance.ca.ChristmasEveEarlyClose
All Implemented Interfaces:
Function<Integer,LocalDate>, Predicate<Integer>, Observance

public class ChristmasEveEarlyClose extends AbstractObservance
Observance of the Toronto Stock Exchange's Christmas Eve half-day close (December 24). Unlike org.holiday.calendar.observance.us.ChristmasEveEarlyClose — whose eligibility is keyed off December 25's day of week — TSX's rule is keyed directly off December 24 itself: the early close applies whenever December 24 falls Monday through Friday, and is suppressed entirely (not shifted, unlike org.holiday.calendar.observance.uk.ChristmasEveEarlyClose) when December 24 falls on a weekend. This is why isValidYear(int) is overridden here to signal absence in ineligible years, rather than computeDate(int) shifting to a different day.

Note this differs from the only other pre-existing use of isValidYear(int) in this codebase (WesternEaster / OrthodoxEaster), where it bounds algorithm validity rather than encoding a business-calendar exclusion — the same mechanism, two different purposes.

Verified against TMX Group's official Holiday Operating Schedule (tsx.com trading calendar / TMX PDF schedules), 2017-2026. Confirmed divergence from NYSE convention in 2021: December 25, 2021 fell on a Saturday (which would suppress NYSE's Dec 24 early close), yet December 24, 2021 fell on a Friday and TSX held its early close that day.

Author:
Dave Joyce
  • Constructor Details

    • ChristmasEveEarlyClose

      public ChristmasEveEarlyClose()
  • Method Details

    • computeDate

      protected LocalDate computeDate(int year)
      Description copied from class: AbstractObservance
      Compute the date for this observance in the given year. Only called when AbstractObservance.isValidYear(int) returns true.
      Specified by:
      computeDate in class AbstractObservance
      Parameters:
      year - the year for which to compute the date
      Returns:
      computed holiday date
    • isValidYear

      protected boolean isValidYear(int year)
      Description copied from class: AbstractObservance
      Determine whether this observance applies in the given year. Defaults to true (all years are valid).
      Overrides:
      isValidYear in class AbstractObservance
      Parameters:
      year - the year to test
      Returns:
      true if this observance applies