diff --git a/src/Calendar.php b/src/Calendar.php index 6ec78ac..df6cc38 100644 --- a/src/Calendar.php +++ b/src/Calendar.php @@ -527,7 +527,7 @@ protected function getColor($ganZhi) return null; } - return $this->colors[array_search($this->gan, $gan)]; + return $this->colors[array_search($gan, $this->gan)]; } /** @@ -549,7 +549,7 @@ protected function getWuXing($ganZhi) return null; } - return $this->wuXing[array_search($this->gan, $gan)]; + return $this->wuXing[array_search($gan, $this->gan)]; } /** @@ -659,7 +659,8 @@ public function solar2lunar($year, $month, $day, $hour = null) if ($secondNode == $day) { $termIndex = $month * 2 - 1; } - $term = $this->solarTerm[$termIndex]; + + $term = null != $termIndex ? $this->solarTerm[$termIndex] : null; // 日柱 当月一日与 1900/1/1 相差天数 $dayCyclical = $this->dateDiff("{$year}-{$month}-01", '1900-01-01')->days + 10;