Skip to content

Commit

Permalink
fix datetime and timezone issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed May 22, 2022
1 parent 6550578 commit ec772a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions includes/LitCalAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1586,8 +1586,8 @@ private function calculateWeekdaysOrdinaryTime() : void {
// so that our cycle using "next Saturday" logic will actually start from the first Saturday of the year ),
// and then continue for every next Saturday until we reach the last Saturday of the year
private function calculateSaturdayMemorialBVM() : void {
$currentSaturday = new DateTime( "previous Saturday January {$this->LitSettings->Year}", new DateTimeZone( 'UTC' ) );
$lastSatDT = new DateTime( "last Saturday December {$this->LitSettings->Year}", new DateTimeZone( 'UTC' ) );
$currentSaturday = new LitDateTime( "previous Saturday January {$this->LitSettings->Year}", new DateTimeZone( 'UTC' ) );
$lastSatDT = new LitDateTime( "last Saturday December {$this->LitSettings->Year}", new DateTimeZone( 'UTC' ) );
$SatMemBVM_cnt = 0;
while( $currentSaturday <= $lastSatDT ){
$currentSaturday = LitDateTime::createFromFormat( '!j-n-Y', $currentSaturday->format( 'j-n-Y' ),new DateTimeZone( 'UTC' ) )->modify( 'next Saturday' );
Expand Down Expand Up @@ -1770,7 +1770,8 @@ private function createNewRegionalOrNationalFestivity( object $row ) : void {
&& $row->Festivity->strtotime !== ''
) {
$festivityDateTS = strtotime( $row->Festivity->strtotime . ' ' . $this->LitSettings->Year . ' UTC' );
$row->Festivity->DATE = new DateTime( "@$festivityDateTS", new DateTimeZone( 'UTC' ) );
$row->Festivity->DATE = new LitDateTime( "@$festivityDateTS" );
$row->Festivity->DATE->setTimeZone(new DateTimeZone('UTC'));
}
else if(
property_exists( $row->Festivity, 'month' )
Expand Down

0 comments on commit ec772a0

Please sign in to comment.