mirror of
https://gitee.com/6tail/lunar-csharp.git
synced 2025-12-06 10:19:07 +08:00
新增万圣节、万圣节前夜;新增全国中小学生安全教育日;新增春社( 原二月初二春社改为社日节)、秋社;新增寒食节。
This commit is contained in:
@@ -990,6 +990,35 @@ namespace com.nlf.calendar
|
||||
l.AddRange(LunarUtil.OTHER_FESTIVAL[month + "-" + day]);
|
||||
}
|
||||
catch { }
|
||||
|
||||
string solarYmd = solar.toYmd();
|
||||
Solar jq = jieQi["清明"];
|
||||
if (solarYmd.Equals(jq.next(-1).toYmd()))
|
||||
{
|
||||
l.Add("寒食节");
|
||||
}
|
||||
|
||||
jq = jieQi["立春"];
|
||||
int offset = 4 - jq.getLunar().getDayGanIndex();
|
||||
if (offset < 0)
|
||||
{
|
||||
offset += 10;
|
||||
}
|
||||
if (solarYmd.Equals(jq.next(offset + 40).toYmd()))
|
||||
{
|
||||
l.Add("春社");
|
||||
}
|
||||
|
||||
jq = jieQi["立秋"];
|
||||
offset = 4 - jq.getLunar().getDayGanIndex();
|
||||
if (offset < 0)
|
||||
{
|
||||
offset += 10;
|
||||
}
|
||||
if (solarYmd.Equals(jq.next(offset + 40).toYmd()))
|
||||
{
|
||||
l.Add("秋社");
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
[assembly: AssemblyVersion("1.2.17.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.17.0")]
|
||||
[assembly: AssemblyVersion("1.2.18.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.18.0")]
|
||||
|
||||
@@ -438,6 +438,14 @@ namespace com.nlf.calendar
|
||||
l.Add(SolarUtil.WEEK_FESTIVAL[month + "-" + weeks + "-" + week]);
|
||||
}
|
||||
catch { }
|
||||
if (day + 7 >= SolarUtil.getDaysOfMonth(year, month))
|
||||
{
|
||||
try
|
||||
{
|
||||
l.Add(SolarUtil.WEEK_FESTIVAL[month + "-0-" + week]);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<Summary>a calendar library for Solar and Chinese Lunar</Summary>
|
||||
<PackageTags>日历;公历;阳历;农历;阴历;老黄历;佛历;道历;法定假日</PackageTags>
|
||||
<Description>日历、公历(阳历)、农历(阴历、老黄历)、佛历、道历,节假日、星座、儒略日、干支、生肖、节气、节日、彭祖百忌、每日宜忌、吉神宜趋凶煞宜忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道日及吉凶等。</Description>
|
||||
<PackageReleaseNotes>支持获取当年第几周;支持2种流派获取起运。</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.17.0</Version>
|
||||
<Version>1.2.18.0</Version>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace com.nlf.calendar.util
|
||||
OTHER_FESTIVAL.Add("1-25", new List<string>(new string[] { "填仓节" }));
|
||||
OTHER_FESTIVAL.Add("1-30", new List<string>(new string[] { "正月晦" }));
|
||||
OTHER_FESTIVAL.Add("2-1", new List<string>(new string[] { "中和节" }));
|
||||
OTHER_FESTIVAL.Add("2-2", new List<string>(new string[] { "春社" }));
|
||||
OTHER_FESTIVAL.Add("2-2", new List<string>(new string[] { "社日节" }));
|
||||
OTHER_FESTIVAL.Add("3-3", new List<string>(new string[] { "上巳节" }));
|
||||
OTHER_FESTIVAL.Add("5-20", new List<string>(new string[] { "分龙节" }));
|
||||
OTHER_FESTIVAL.Add("5-25", new List<string>(new string[] { "会龙节" }));
|
||||
|
||||
@@ -43,9 +43,12 @@ namespace com.nlf.calendar.util
|
||||
FESTIVAL.Add("8-1", "建军节");
|
||||
FESTIVAL.Add("9-10", "教师节");
|
||||
FESTIVAL.Add("10-1", "国庆节");
|
||||
FESTIVAL.Add("10-31", "万圣节前夜");
|
||||
FESTIVAL.Add("11-1", "万圣节");
|
||||
FESTIVAL.Add("12-24", "平安夜");
|
||||
FESTIVAL.Add("12-25", "圣诞节");
|
||||
|
||||
WEEK_FESTIVAL.Add("3-0-1", "全国中小学生安全教育日");
|
||||
WEEK_FESTIVAL.Add("5-2-0", "母亲节");
|
||||
WEEK_FESTIVAL.Add("6-3-0", "父亲节");
|
||||
WEEK_FESTIVAL.Add("11-4-4", "感恩节");
|
||||
|
||||
@@ -563,6 +563,22 @@ namespace test
|
||||
Assert.AreEqual("厕灶厨 外西南", lunar.getDayPositionTai());
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void test53()
|
||||
{
|
||||
Solar solar = Solar.fromYmd(1722, 9, 25);
|
||||
Lunar lunar = solar.getLunar();
|
||||
Assert.AreEqual("秋社", lunar.getOtherFestivals()[0]);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void test54()
|
||||
{
|
||||
Solar solar = Solar.fromYmd(2021, 3, 21);
|
||||
Lunar lunar = solar.getLunar();
|
||||
Assert.AreEqual("春社", lunar.getOtherFestivals()[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -154,6 +154,13 @@ namespace test
|
||||
Solar solar = Solar.fromYmd(26, 4, 13);
|
||||
Assert.AreEqual("二六年三月初八", solar.getLunar().ToString());
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void test10()
|
||||
{
|
||||
Solar solar = Solar.fromYmd(2022, 3, 28);
|
||||
Assert.AreEqual("全国中小学生安全教育日", solar.getFestivals()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user