From 3e1a79a87cc698e52b4fd494ddaea5b8eb3417cb Mon Sep 17 00:00:00 2001 From: 6tail <6tail@6tail.cn> Date: Tue, 19 Mar 2024 08:19:27 +0800 Subject: [PATCH] =?UTF-8?q?v1.3.15=20=E4=BF=AE=E5=A4=8D=E5=85=AB=E5=AD=97?= =?UTF-8?q?=E8=BD=AC=E9=98=B3=E5=8E=86=E5=AD=98=E5=9C=A8=E9=81=97=E6=BC=8F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ Lunar.php | 4 +--- demo.php | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83010d8..696a883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,3 +5,6 @@ 1. 修复节气当天获取下一节气仍为当前节气的问题。 2. 修复每日宜忌存在重复项的问题。 3. 修复八字转阳历存在遗漏的问题。 + +## [1.3.15] - 2024-03-19 +1. 修复八字转阳历存在遗漏的问题。 diff --git a/Lunar.php b/Lunar.php index ce503f7..2b93709 100644 --- a/Lunar.php +++ b/Lunar.php @@ -8915,9 +8915,7 @@ public static function fromBaZiBySectAndBaseYear($yearGanZhi, $monthGanZhi, $day $solarTime = $jieQiTable[Lunar::$JIE_QI_IN_USE[4 + $m]]; if ($solarTime->getYear() >= $baseYear) { // 日干支和节令干支的偏移值 - $lunar = $solarTime->getLunar(); - $dgz = (2 == $sect) ? $lunar->getDayInGanZhiExact2() : $lunar->getDayInGanZhiExact(); - $d = LunarUtil::getJiaZiIndex($dayGanZhi) - LunarUtil::getJiaZiIndex($dgz); + $d = LunarUtil::getJiaZiIndex($dayGanZhi) - LunarUtil::getJiaZiIndex($solarTime->getLunar()->getDayInGanZhiExact2()); if ($d < 0) { $d += 60; } diff --git a/demo.php b/demo.php index ba9cfd3..5eff12d 100644 --- a/demo.php +++ b/demo.php @@ -320,3 +320,9 @@ // 佛历 $foto = Foto::fromLunar(Lunar::fromYmd(2021, 10, 14)); echo $foto->toFullString() . "\n"; + +$solar = Solar::fromYmdHms(2000, 1, 23, 22, 0, 0); +$lunar = $solar->getLunar(); +$eightChar = $lunar->getEightChar(); +// 己卯 丁丑 庚辰 丁亥 +echo $eightChar->getYear() . " " . $eightChar->getMonth(). " " . $eightChar->getDay(). " " . $eightChar->getTime() . "\n";