Skip to content

Commit

Permalink
Update day calculation for midnight and last third
Browse files Browse the repository at this point in the history
  • Loading branch information
meezaan committed Mar 13, 2024
1 parent ddd3536 commit 46b4d4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PrayerTimes/PrayerTimes.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ private function getFormattedTime($time, $format, $prayer)
// Create temporary date object
$date = clone $this->date;
$date->setTime($hours, $twoDigitMinutes);
if ($prayer == 'Midnight') {
if ($hours >= 1 && $hours < 12) {
if (in_array($prayer, ['Midnight', 'Lastthird'])) {
if ($hours < 12) { // Hours are in military time, so if this falls on the next day, it will always be less than 12
$date->modify('+1 day');
}
}
Expand Down

0 comments on commit 46b4d4e

Please sign in to comment.