Module org.holiday.calendar.western
Class ChristmasEveEarlyClose
java.lang.Object
org.holiday.calendar.observance.AbstractObservance
org.holiday.calendar.observance.ca.ChristmasEveEarlyClose
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LocalDatecomputeDate(int year) Compute the date for this observance in the given year.protected booleanisValidYear(int year) Determine whether this observance applies in the given year.Methods inherited from class org.holiday.calendar.observance.AbstractObservance
apply, test
-
Constructor Details
-
ChristmasEveEarlyClose
public ChristmasEveEarlyClose()
-
-
Method Details
-
computeDate
Description copied from class:AbstractObservanceCompute the date for this observance in the given year. Only called whenAbstractObservance.isValidYear(int)returnstrue.- Specified by:
computeDatein classAbstractObservance- Parameters:
year- the year for which to compute the date- Returns:
- computed holiday date
-
isValidYear
protected boolean isValidYear(int year) Description copied from class:AbstractObservanceDetermine whether this observance applies in the given year. Defaults totrue(all years are valid).- Overrides:
isValidYearin classAbstractObservance- Parameters:
year- the year to test- Returns:
trueif this observance applies
-