From 8ceab849867da7924e2fc5037b061756ec7e0bf4 Mon Sep 17 00:00:00 2001 From: 6tail <6tail@6tail.cn> Date: Sun, 7 Sep 2025 08:56:46 +0800 Subject: [PATCH] =?UTF-8?q?v1.7.4=20=E4=BF=AE=E5=A4=8D=E6=9E=81=E7=AB=AF?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E5=85=AB=E5=AD=97=E8=BD=AC=E5=85=AC?= =?UTF-8?q?=E5=8E=86=E6=97=B6=E5=88=BB=E5=87=BA=E7=8E=B0=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 +++ __tests__/EightChar.test.js | 9 +++++++++ lunar.js | 3 +++ package.json | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f206a72..0657c16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,3 +29,6 @@ ## [1.7.3] - 2025-04-29 1. 修复身宫报错的问题。 + +## [1.7.4] - 2025-09-07 +1. 修复极端情况下八字转公历时刻出现遗漏的问题。 diff --git a/__tests__/EightChar.test.js b/__tests__/EightChar.test.js index 60e00fe..bef34c7 100644 --- a/__tests__/EightChar.test.js +++ b/__tests__/EightChar.test.js @@ -249,3 +249,12 @@ test('test28', () => { }) expect(timeList).toStrictEqual(['1987-08-03 02:00:00']); }); + +test('test29', () => { + const solarList = Solar.fromBaZi('壬申','壬寅','庚辰','甲申', 1, 1801); + const timeList = []; + solarList.forEach(solar => { + timeList.push(solar.toYmdHms()); + }) + expect(timeList).toStrictEqual(['1812-02-18 16:00:00', '1992-03-05 15:00:00']); +}); diff --git a/lunar.js b/lunar.js index d4e7f04..6391c70 100644 --- a/lunar.js +++ b/lunar.js @@ -603,6 +603,9 @@ } // 验证一下 var solar = Solar.fromYmdHms(solarTime.getYear(), solarTime.getMonth(), solarTime.getDay(), hour, mi, s); + if (d === 30) { + solar = solar.nextHour(-1); + } var lunar = solar.getLunar(); var dgz = (2 === sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact(); if (lunar.getYearInGanZhiExact() === yearGanZhi && lunar.getMonthInGanZhiExact() === monthGanZhi && dgz === dayGanZhi && lunar.getTimeInGanZhi() === timeGanZhi) { diff --git a/package.json b/package.json index 15e2dd2..03e0f96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lunar-javascript", - "version": "1.7.3", + "version": "1.7.4", "description": "lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)、佛历和道历工具,支持星座、儒略日、干支、生肖、节气、节日、彭祖百忌、每日宜忌、吉神宜趋、凶煞宜忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道日及吉凶等。lunar is a calendar library for Solar and Chinese Lunar.", "main": "index.js", "scripts": {