mirror of
https://gitee.com/6tail/lunar-csharp.git
synced 2025-12-06 10:19:07 +08:00
v1.2.16.0 新增阴历年、阴历月的推移;修复三候错误;修复道历节日错别字。
This commit is contained in:
@@ -3020,10 +3020,15 @@ namespace com.nlf.calendar
|
||||
public string getHou()
|
||||
{
|
||||
JieQi jieQi = getPrevJieQi(true);
|
||||
string name = jieQi.getName();
|
||||
Solar startSolar = jieQi.getSolar();
|
||||
int days = ExactDate.getDaysBetween(startSolar.getYear(), startSolar.getMonth(), startSolar.getDay(), solar.getYear(), solar.getMonth(), solar.getDay());
|
||||
return name + " " + LunarUtil.HOU[(days / 5) % LunarUtil.HOU.Length];
|
||||
int max = LunarUtil.HOU.Length - 1;
|
||||
int offset = days / 5;
|
||||
if (offset > max)
|
||||
{
|
||||
offset = max;
|
||||
}
|
||||
return jieQi.getName() + " " + LunarUtil.HOU[offset];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -164,5 +164,80 @@ namespace com.nlf.calendar
|
||||
{
|
||||
return year + "年" + (isLeap() ? "闰" : "") + LunarUtil.MONTH[Math.Abs(month)] + "月(" + dayCount + "天)";
|
||||
}
|
||||
|
||||
public LunarMonth next(int n)
|
||||
{
|
||||
if (0 == n)
|
||||
{
|
||||
return LunarMonth.fromYm(year, month);
|
||||
}
|
||||
else if (n > 0)
|
||||
{
|
||||
int rest = n;
|
||||
int ny = year;
|
||||
int iy = ny;
|
||||
int im = month;
|
||||
int index = 0;
|
||||
List<LunarMonth> months = LunarYear.fromYear(ny).getMonths();
|
||||
while (true)
|
||||
{
|
||||
int size = months.Count;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
LunarMonth m = months[i];
|
||||
if (m.getYear() == iy && m.getMonth() == im)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int more = size - index - 1;
|
||||
if (rest < more)
|
||||
{
|
||||
break;
|
||||
}
|
||||
rest -= more;
|
||||
LunarMonth lastMonth = months[size - 1];
|
||||
iy = lastMonth.getYear();
|
||||
im = lastMonth.getMonth();
|
||||
ny++;
|
||||
months = LunarYear.fromYear(ny).getMonths();
|
||||
}
|
||||
return months[index + rest];
|
||||
}
|
||||
else
|
||||
{
|
||||
int rest = -n;
|
||||
int ny = year;
|
||||
int iy = ny;
|
||||
int im = month;
|
||||
int index = 0;
|
||||
List<LunarMonth> months = LunarYear.fromYear(ny).getMonths();
|
||||
while (true)
|
||||
{
|
||||
int size = months.Count;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
LunarMonth m = months[i];
|
||||
if (m.getYear() == iy && m.getMonth() == im)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rest <= index)
|
||||
{
|
||||
break;
|
||||
}
|
||||
rest -= index;
|
||||
LunarMonth firstMonth = months[0];
|
||||
iy = firstMonth.getYear();
|
||||
im = firstMonth.getMonth();
|
||||
ny--;
|
||||
months = LunarYear.fromYear(ny).getMonths();
|
||||
}
|
||||
return months[index - rest];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -623,5 +623,15 @@ namespace com.nlf.calendar
|
||||
{
|
||||
return LunarUtil.POSITION_DESC[getPositionTaiSui()];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取往后推几年的阴历年,如果要往前推,则年数用负数
|
||||
/// </summary>
|
||||
/// <param name="n">年数</param>
|
||||
/// <returns>阴历年</returns>
|
||||
public LunarYear next(int n)
|
||||
{
|
||||
return LunarYear.fromYear(year + n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
[assembly: AssemblyVersion("1.2.15.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.15.0")]
|
||||
[assembly: AssemblyVersion("1.2.16.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.16.0")]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Title>lunar-csharp</Title>
|
||||
@@ -7,13 +7,13 @@
|
||||
<Summary>a calendar library for Solar and Chinese Lunar</Summary>
|
||||
<PackageTags>日历;公历;阳历;农历;阴历;老黄历;佛历;道历;法定假日</PackageTags>
|
||||
<Description>日历、公历(阳历)、农历(阴历、老黄历)、佛历、道历,节假日、星座、儒略日、干支、生肖、节气、节日、彭祖百忌、每日宜忌、吉神宜趋凶煞宜忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道日及吉凶等。</Description>
|
||||
<PackageReleaseNotes>修复获取上下节气报错的问题。</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>新增阴历年、阴历月的推移;修复三候错误;修复道历节日错别字。</PackageReleaseNotes>
|
||||
<Copyright>版权所有 (c) 2021</Copyright>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageProjectUrl>http://6tail.cn/calendar/api.html</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/6tail/lunar-csharp.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Version>1.2.15.0</Version>
|
||||
<Version>1.2.16.0</Version>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace com.nlf.calendar.util
|
||||
BA_JIE.Add("立冬", "西北方无量太华天尊同梵炁始玄天君下降");
|
||||
BA_JIE.Add("冬至", "北方玄上玉宸天尊同黑帝五炁天君下降");
|
||||
|
||||
FESTIVAL.Add("1-1", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("天腊之辰", "天腊,此日五帝会于束方九炁青天") }));
|
||||
FESTIVAL.Add("1-1", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("天腊之辰", "天腊,此日五帝会于东方九炁青天") }));
|
||||
FESTIVAL.Add("1-3", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("郝真人圣诞"), new TaoFestival("孙真人圣诞") }));
|
||||
FESTIVAL.Add("1-5", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("孙祖清静元君诞") }));
|
||||
FESTIVAL.Add("1-7", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("举迁赏会", "此日上元赐福,天官同地水二官考校罪福") }));
|
||||
@@ -101,7 +101,7 @@ namespace com.nlf.calendar.util
|
||||
FESTIVAL.Add("4-20", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("眼光圣母娘娘诞") }));
|
||||
FESTIVAL.Add("4-28", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("神农先帝诞") }));
|
||||
FESTIVAL.Add("5-1", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("南极长生大帝圣诞") }));
|
||||
FESTIVAL.Add("5-5", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("地腊之辰", "地腊,此日五帝会於南方三炁丹天"), new TaoFestival("南方雷祖圣诞"), new TaoFestival("地祗温元帅圣诞"), new TaoFestival("雷霆邓天君圣诞") }));
|
||||
FESTIVAL.Add("5-5", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("地腊之辰", "地腊,此日五帝会于南方三炁丹天"), new TaoFestival("南方雷祖圣诞"), new TaoFestival("地祗温元帅圣诞"), new TaoFestival("雷霆邓天君圣诞") }));
|
||||
FESTIVAL.Add("5-11", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("城隍爷圣诞") }));
|
||||
FESTIVAL.Add("5-13", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("关圣帝君降神"), new TaoFestival("关平太子圣诞") }));
|
||||
FESTIVAL.Add("5-18", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("张天师圣诞") }));
|
||||
@@ -143,7 +143,7 @@ namespace com.nlf.calendar.util
|
||||
FESTIVAL.Add("9-22", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("增福财神诞") }));
|
||||
FESTIVAL.Add("9-23", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("萨翁真君圣诞") }));
|
||||
FESTIVAL.Add("9-28", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("五显灵官马元帅圣诞") }));
|
||||
FESTIVAL.Add("10-1", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("民岁腊之辰", "民岁腊,此日五帝会於北方五炁黑天"), new TaoFestival("东皇大帝圣诞") }));
|
||||
FESTIVAL.Add("10-1", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("民岁腊之辰", "民岁腊,此日五帝会于北方五炁黑天"), new TaoFestival("东皇大帝圣诞") }));
|
||||
FESTIVAL.Add("10-3", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("三茅应化真君圣诞") }));
|
||||
FESTIVAL.Add("10-6", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("天曹诸司五岳五帝圣诞") }));
|
||||
FESTIVAL.Add("10-15", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("下元水官大帝圣诞"), new TaoFestival("建生大会", "此日下元解厄,水官同天地二官考校罪福") }));
|
||||
@@ -154,7 +154,7 @@ namespace com.nlf.calendar.util
|
||||
FESTIVAL.Add("11-9", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("湘子韩祖圣诞") }));
|
||||
FESTIVAL.Add("11-11", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("太乙救苦天尊圣诞") }));
|
||||
FESTIVAL.Add("11-26", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("北方五道圣诞") }));
|
||||
FESTIVAL.Add("12-8", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("王侯腊之辰", "王侯腊,此日五帝会於上方玄都玉京") }));
|
||||
FESTIVAL.Add("12-8", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("王侯腊之辰", "王侯腊,此日五帝会于上方玄都玉京") }));
|
||||
FESTIVAL.Add("12-16", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("南岳大帝圣诞"), new TaoFestival("福德正神诞") }));
|
||||
FESTIVAL.Add("12-20", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("鲁班先师圣诞") }));
|
||||
FESTIVAL.Add("12-21", new List<TaoFestival>(new TaoFestival[] { new TaoFestival("天猷上帝圣诞") }));
|
||||
|
||||
Reference in New Issue
Block a user