mirror of
https://gitee.com/6tail/lunar-csharp.git
synced 2025-12-06 10:19:07 +08:00
v1.1.0.23 修复阴历实例化问题。
This commit is contained in:
@@ -244,7 +244,7 @@ namespace com.nlf.calendar
|
||||
this.hour = hour;
|
||||
this.minute = minute;
|
||||
this.second = second;
|
||||
dayOffset = LunarUtil.computeAddDays(year, month, day);
|
||||
this.dayOffset = LunarUtil.computeAddDays(year, month, day);
|
||||
this.solar = toSolar();
|
||||
compute();
|
||||
}
|
||||
@@ -317,7 +317,7 @@ namespace com.nlf.calendar
|
||||
|
||||
private Solar toSolar()
|
||||
{
|
||||
DateTime c = new DateTime(SolarUtil.BASE_YEAR, SolarUtil.BASE_MONTH - 1, SolarUtil.BASE_DAY, hour, minute, second);
|
||||
DateTime c = new DateTime(SolarUtil.BASE_YEAR, SolarUtil.BASE_MONTH, SolarUtil.BASE_DAY, hour, minute, second);
|
||||
c = c.AddDays(dayOffset);
|
||||
return new Solar(c);
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
[assembly: AssemblyVersion("1.1.0.22")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.22")]
|
||||
[assembly: AssemblyVersion("1.1.0.23")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.23")]
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace test
|
||||
|
||||
|
||||
/// <summary>
|
||||
///fix (string[], string) 的测试
|
||||
/// next 的测试
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void testNext()
|
||||
@@ -97,6 +97,29 @@ namespace test
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void testConvert()
|
||||
{
|
||||
Solar solar = new Solar(2020, 1, 23);
|
||||
Lunar lunar = solar.getLunar();
|
||||
Assert.AreEqual("二〇一九年腊月廿九", lunar.ToString(), "com.nlf.calendar.Solar.getLunar 有错。");
|
||||
Assert.AreEqual("2020-01-23", lunar.getSolar().ToString(), "com.nlf.calendar.Lunar.getSolar 有错。");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void testConvert1()
|
||||
{
|
||||
Lunar lunar = new Lunar(2019, 12, 29);
|
||||
Assert.AreEqual("二〇一九年腊月廿九", lunar.ToString(), "com.nlf.calendar.Solar.getLunar 有错。");
|
||||
Assert.AreEqual("2020-01-23", lunar.getSolar().ToString(), "com.nlf.calendar.Lunar.getSolar 有错。");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user