Skip to content

Commit

Permalink
v1.5.11 修复八字转阳历存在遗漏的问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
6tail committed Mar 18, 2024
1 parent 8852537 commit aafce0a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
1. 修复节气当天获取下一节气仍为当前节气的问题。
2. 修复每日宜忌存在重复项的问题。
3. 八字转阳历结果按时间先后排序,转换速度大幅提升。

## [1.5.11] - 2024-03-18
1. 修复八字转阳历存在遗漏的问题。
10 changes: 4 additions & 6 deletions lunar/Solar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ public static List<Solar> FromBaZi(string yearGanZhi, string monthGanZhi, string
if (solarTime.Year >= baseYear)
{
// 日干支和节令干支的偏移值
var lunar = solarTime.Lunar;
var dgz = (2 == sect) ? lunar.DayInGanZhiExact2 : lunar.DayInGanZhiExact;
var d = LunarUtil.GetJiaZiIndex(dayGanZhi) - LunarUtil.GetJiaZiIndex(dgz);
var d = LunarUtil.GetJiaZiIndex(dayGanZhi) - LunarUtil.GetJiaZiIndex(solarTime.Lunar.DayInGanZhiExact2);
if (d < 0)
{
d += 60;
Expand All @@ -301,9 +299,9 @@ public static List<Solar> FromBaZi(string yearGanZhi, string monthGanZhi, string
}

// 验证一下
var solar = Solar.FromYmdHms(solarTime.Year, solarTime.Month, solarTime.Day, hour, mi, s);
lunar = solar.Lunar;
dgz = (2 == sect) ? lunar.DayInGanZhiExact2 : lunar.DayInGanZhiExact;
var solar = FromYmdHms(solarTime.Year, solarTime.Month, solarTime.Day, hour, mi, s);
var lunar = solar.Lunar;
var dgz = (2 == sect) ? lunar.DayInGanZhiExact2 : lunar.DayInGanZhiExact;
if (lunar.YearInGanZhiExact.Equals(yearGanZhi) &&
lunar.MonthInGanZhiExact.Equals(monthGanZhi) && dgz.Equals(dayGanZhi) &&
lunar.TimeInGanZhi.Equals(timeGanZhi))
Expand Down
8 changes: 4 additions & 4 deletions lunar/lunar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Lunar</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<PackageId>lunar-csharp</PackageId>
<PackageVersion>1.5.10</PackageVersion>
<PackageVersion>1.5.11</PackageVersion>
<Title>无依赖的阳历、阴历、道历和佛历工具库</Title>
<Authors>6tail</Authors>
<Description>日历、公历(阳历)、农历(阴历、老黄历)、佛历、道历,节假日、星座、儒略日、干支、生肖、节气、节日、彭祖百忌、每日宜忌、吉神宜趋凶煞宜忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道日及吉凶等。</Description>
Expand All @@ -16,9 +16,9 @@
<RepositoryType>git</RepositoryType>
<PackageTags>日历;公历;阳历;农历;阴历;老黄历;佛历;道历;法定假日</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AssemblyVersion>1.5.10</AssemblyVersion>
<FileVersion>1.5.10</FileVersion>
<PackageReleaseNotes>修复节气当天获取下一节气仍为当前节气的问题;修复每日宜忌存在重复项的问题;八字转阳历结果按时间先后排序,转换速度大幅提升。</PackageReleaseNotes>
<AssemblyVersion>1.5.11</AssemblyVersion>
<FileVersion>1.5.11</FileVersion>
<PackageReleaseNotes>修复八字转阳历存在遗漏的问题。</PackageReleaseNotes>
<PackageIcon>lunar.png</PackageIcon>
<PackageLicenseUrl>https://raw.githubusercontent.com/6tail/lunar-csharp/master/LICENSE</PackageLicenseUrl>
</PropertyGroup>
Expand Down

0 comments on commit aafce0a

Please sign in to comment.