Skip to content

Commit 821d228

Browse files
committed
fix: zodiac detection
1 parent 084d99e commit 821d228

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Reader.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,18 @@ public function getZodiac()
336336
$rangeStart = explode('/', $range[0]);
337337
$rangeEnd = explode('/', $range[1]);
338338

339-
if (($month <> intval($rangeStart[1])) && ($month <> intval($rangeEnd[1]))) {
340-
continue;
341-
}
339+
$cd1 = intval($rangeStart[0]);
340+
$cm1 = intval($rangeStart[1]);
341+
342+
$cd2 = intval($rangeEnd[0]);
343+
$cm2 = intval($rangeEnd[1]);
344+
345+
$min = strtotime(date('Y').'-'.$cm1.'-'.$cd1.' 00:00:00');
346+
$max = strtotime(date('Y').'-'.$cm2.'-'.$cd2.' 00:00:00');
347+
348+
$target = strtotime(date('Y').'-'.$month.'-'.$day.' 00:00:00');
342349

343-
if ($day >= intval($rangeStart[0]) || $day <= intval($rangeEnd[0])) {
350+
if ($target >= $min && $target <= $max) {
344351
$this->zodiac = $data[1];
345352
break;
346353
}

0 commit comments

Comments
 (0)