fix close calculations

This commit is contained in:
Ryan Prather 2024-12-31 23:03:19 +00:00
parent e44b346788
commit 1d16cadc7b

View File

@ -110,7 +110,7 @@ class CommunityResource
private ?float $lon = null;
public function __construct(
private DateTime $today = new DateTime('now', new DateTimeZone('America/New_York'))
private DateTime $today = new DateTime('now', new DateTimeZone('America/Indiana/Indianapolis'))
) {
}
@ -309,7 +309,7 @@ class CommunityResource
return 'C';
}
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->monClose->format('H:i:s'));
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->monClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
if ($closeAt <= new DateTime()) {
return 'C';
}
@ -347,7 +347,7 @@ class CommunityResource
return 'C';
}
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->tueClose->format('H:i:s'));
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->tueClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
if ($closeAt <= new DateTime()) {
return 'C';
}
@ -385,8 +385,9 @@ class CommunityResource
return 'C';
}
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->wedClose->format('H:i:s'));
if ($closeAt <= new DateTime()) {
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->wedClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
if ($closeAt <= new DateTime("now", new DateTimeZone('America/Indiana/Indianapolis'))) {
return 'C';
}
@ -423,7 +424,7 @@ class CommunityResource
return 'C';
}
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->thuClose->format('H:i:s'));
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->thuClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
if ($closeAt <= new DateTime()) {
return 'C';
}
@ -461,7 +462,7 @@ class CommunityResource
return 'C';
}
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->friClose->format('H:i:s'));
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->friClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
if ($closeAt <= new DateTime()) {
return 'C';
}
@ -499,7 +500,7 @@ class CommunityResource
return 'C';
}
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->satClose->format('H:i:s'));
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->satClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
if ($closeAt <= new DateTime()) {
return 'C';
}
@ -537,7 +538,7 @@ class CommunityResource
return 'C';
}
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->sunClose->format('H:i:s'));
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->sunClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis'));
if ($closeAt <= new DateTime()) {
return 'C';
}
@ -547,7 +548,7 @@ class CommunityResource
public function getHours(): ?string
{
$this->today = new DateTime('now', new DateTimeZone('America/New_York'));
$this->today = new DateTime('now', new DateTimeZone('America/Indiana/Indianapolis'));
switch ($this->today->format('w')) {
case 0:
return $this->sun();