Skip to content

Commit

Permalink
avoid defining year cycle for holy week and octave easter
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed Mar 24, 2024
1 parent ece33dd commit 2adcd8f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 17 deletions.
62 changes: 46 additions & 16 deletions includes/FestivityCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,21 +296,7 @@ private function inOrdinaryTime( LitDateTime $date ) : bool {

public function setCyclesVigilsSeasons() {
foreach( $this->festivities as $key => $festivity ) {
if ( self::DateIsNotSunday( $festivity->date ) && (int)$festivity->grade === LitGrade::WEEKDAY ) {
if( $this->inOrdinaryTime( $festivity->date ) ) {
$this->festivities[ $key ]->liturgicalYear = $this->T[ "YEAR" ] . " " . ( self::WEEKDAY_CYCLE[ ( $this->LitSettings->Year - 1 ) % 2 ] );
}
}
//if we're dealing with a Sunday or a Solemnity or a Feast of the Lord, then we calculate the Sunday/Festive Cycle
else if( self::DateIsSunday( $festivity->date ) || (int)$festivity->grade > LitGrade::FEAST ) {
if ( $festivity->date < $this->festivities[ "Advent1" ]->date ) {
$this->festivities[ $key ]->liturgicalYear = $this->T[ "YEAR" ] . " " . ( self::SUNDAY_CYCLE[ ( $this->LitSettings->Year - 1 ) % 3 ] );
} else if ( $festivity->date >= $this->festivities[ "Advent1" ]->date ) {
$this->festivities[ $key ]->liturgicalYear = $this->T[ "YEAR" ] . " " . ( self::SUNDAY_CYCLE[ $this->LitSettings->Year % 3 ] );
}
$this->calculateVigilMass( $key, $festivity );
}

// DEFINE LITURGICAL SEASONS
if( $festivity->date >= $this->festivities[ "Advent1" ]->date && $festivity->date < $this->festivities[ "Christmas" ]->date ) {
$this->festivities[ $key ]->liturgicalSeason = LitSeason::ADVENT;
}
Expand All @@ -321,14 +307,34 @@ public function setCyclesVigilsSeasons() {
$this->festivities[ $key ]->liturgicalSeason = LitSeason::LENT;
}
else if( $festivity->date > $this->festivities[ "HolyThurs" ]->date && $festivity->date < $this->festivities[ "Easter" ]->date ) {
//the Easter Triduum doesn't really count as either Lent or Easter
$this->festivities[ $key ]->liturgicalSeason = LitSeason::EASTER_TRIDUUM;
}
else if( $festivity->date >= $this->festivities[ "Easter" ]->date && $festivity->date <= $this->festivities[ "Pentecost" ]->date ) {
$this->festivities[ $key ]->liturgicalSeason = LitSeason::EASTER;
}
else {
$this->festivities[ $key ]->liturgicalSeason = LitSeason::ORDINARY_TIME;
}

// DEFINE YEAR CYCLES (except for Holy Week and Easter Octave)
if( $festivity->date <= $this->festivities[ "PalmSun" ]->date && $festivity->date >= $this->festivities[ "Easter2" ]->date ) {
if ( self::DateIsNotSunday( $festivity->date ) && (int)$festivity->grade === LitGrade::WEEKDAY ) {
if( $this->inOrdinaryTime( $festivity->date ) ) {
$this->festivities[ $key ]->liturgicalYear = $this->T[ "YEAR" ] . " " . ( self::WEEKDAY_CYCLE[ ( $this->LitSettings->Year - 1 ) % 2 ] );
}
}
//if we're dealing with a Sunday or a Solemnity or a Feast of the Lord, then we calculate the Sunday/Festive Cycle
else if( self::DateIsSunday( $festivity->date ) || (int)$festivity->grade > LitGrade::FEAST ) {
if ( $festivity->date < $this->festivities[ "Advent1" ]->date ) {
$this->festivities[ $key ]->liturgicalYear = $this->T[ "YEAR" ] . " " . ( self::SUNDAY_CYCLE[ ( $this->LitSettings->Year - 1 ) % 3 ] );
} else if ( $festivity->date >= $this->festivities[ "Advent1" ]->date ) {
$this->festivities[ $key ]->liturgicalYear = $this->T[ "YEAR" ] . " " . ( self::SUNDAY_CYCLE[ $this->LitSettings->Year % 3 ] );
}
// DEFINE VIGIL MASSES
$this->calculateVigilMass( $key, $festivity );
}
}

}
}

Expand Down Expand Up @@ -536,4 +542,28 @@ public static function psalterWeek( int $weekOfOrdinaryTimeOrSeason ) : int {
return $weekOfOrdinaryTimeOrSeason % 4 === 0 ? 4 : $weekOfOrdinaryTimeOrSeason % 4;
}

public function isAdventSeason( Festivity $festivity ) {
return $festivity->liturgicalSeason === LitSeason::ADVENT;
}

public function isChristmasSeason( Festivity $festivity ) {
return $festivity->liturgicalSeason === LitSeason::CHRISTMAS;
}

public function isLentSeason( Festivity $festivity ) {
return $festivity->liturgicalSeason === LitSeason::LENT;
}

public function isEasterTriduum( Festivity $festivity ) {
return $festivity->liturgicalSeason === LitSeason::EASTER_TRIDUUM;
}

public function isEasterSeason( Festivity $festivity ) {
return $festivity->liturgicalSeason === LitSeason::EASTER;
}

public function isOrdinaryTime( Festivity $festivity ) {
return $festivity->liturgicalSeason === LitSeason::ORDINARY_TIME;
}

}
6 changes: 5 additions & 1 deletion includes/enums/LitSeason.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ class LitSeason {
const ADVENT = "ADVENT";
const CHRISTMAS = "CHRISTMAS";
const LENT = "LENT";
const EASTER_TRIDUUM= "EASTER_TRIDUUM";
const EASTER = "EASTER";
const ORDINARY_TIME = "ORDINARY_TIME";
public static array $values = [ "ADVENT", "CHRISTMAS", "LENT", "EASTER", "ORDINARY_TIME" ];
public static array $values = [ "ADVENT", "CHRISTMAS", "LENT", "EASTER_TRIDUUM", "EASTER", "ORDINARY_TIME" ];

public static function isValid( string $value ) {
return in_array( $value, self::$values );
Expand All @@ -23,6 +24,9 @@ public static function i18n( string $value, string $locale ) : string {
case self::LENT:
/**translators: context = liturgical season */
return $locale === LitLocale::LATIN ? 'Tempus Quadragesima' : _( "Lent" );
case self::EASTER_TRIDUUM:
/**translators: context = liturgical season */
return $locale === LitLocale::LATIN ? 'Triduum Paschale' : _( "Easter Triduum" );
case self::EASTER:
/**translators: context = liturgical season */
return $locale === LitLocale::LATIN ? 'Tempus Paschale' : _( "Easter" );
Expand Down

0 comments on commit 2adcd8f

Please sign in to comment.