ChineseLunisolarCalendarYjFwkExtensions 1.1.0

Suggested Alternatives

YiJingFramework.Nongli

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package ChineseLunisolarCalendarYjFwkExtensions --version 1.1.0                
NuGet\Install-Package ChineseLunisolarCalendarYjFwkExtensions -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ChineseLunisolarCalendarYjFwkExtensions" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ChineseLunisolarCalendarYjFwkExtensions --version 1.1.0                
#r "nuget: ChineseLunisolarCalendarYjFwkExtensions, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ChineseLunisolarCalendarYjFwkExtensions as a Cake Addin
#addin nuget:?package=ChineseLunisolarCalendarYjFwkExtensions&version=1.1.0

// Install ChineseLunisolarCalendarYjFwkExtensions as a Cake Tool
#tool nuget:?package=ChineseLunisolarCalendarYjFwkExtensions&version=1.1.0                

ChineseLunisolarCalendarYjFwkExtensions

ChineseLunisolarCalendarYjFwkExtensions 为 System.Globalization.ChineseLunisolarCalendar 提供了一些扩展方法。以下是一些的示例:

年干支和时辰地支

[TestMethod()]
public void GetYearGanzhiTest()
{
    var calendar = new ChineseLunisolarCalendar();
    var dateTime = new DateTime(2023, 8, 16, 12, 41, 23);

    var (gan, zhi) = calendar.GetYearGanzhi(dateTime);
    Assert.AreEqual(Tiangan.Gui, gan);
    Assert.AreEqual(Dizhi.Mao, zhi);
}

[TestMethod()]
public void GetShichenDizhiTest()
{
    var calendar = new ChineseLunisolarCalendar();
    var dateTime = new DateTime(2023, 8, 16, 12, 41, 23);

    var shichen = calendar.GetShichenDizhi(dateTime);
    Assert.AreEqual(Dizhi.Wu, shichen);
}

年月日的中文表示

[TestMethod()]
public void GetYearGanzhiInChineseTest()
{
    var calendar = new ChineseLunisolarCalendar();
    var dateTime = new DateTime(2023, 8, 16, 12, 41, 23);

    var year = calendar.GetYearGanzhiInChinese(dateTime);
    Assert.AreEqual("癸卯", year);
}

[TestMethod()]
public void GetYearInChineseTest()
{
    var calendar = new ChineseLunisolarCalendar();
    var dateTime = new DateTime(2023, 8, 16, 12, 41, 23);

    var year = calendar.GetYearInChinese(dateTime);
    Assert.AreEqual("二〇二三", year);

    var year2 = calendar.GetYearInChinese(dateTime, zero: '零');
    Assert.AreEqual("二零二三", year2);
}

[TestMethod()]
public void GetMonthInChineseTest()
{
    var calendar = new ChineseLunisolarCalendar();

    var dateTime1 = new DateTime(2023, 8, 16, 12, 41, 23);
    var month1 = calendar.GetMonthInChinese(dateTime1);
    Assert.AreEqual("七", month1);

    var dateTime2 = new DateTime(2023, 4, 19, 12, 41, 23);
    var month2 = calendar.GetMonthInChinese(dateTime2);
    Assert.AreEqual("闰二", month2);

    var dateTime3 = new DateTime(2023, 2, 17, 12, 41, 23);
    var month3 = calendar.GetMonthInChinese(dateTime3);
    Assert.AreEqual("正", month3);
}

[TestMethod()]
public void GetDayInChineseTest()
{
    var calendar = new ChineseLunisolarCalendar();
    var dateTime = new DateTime(2023, 8, 15, 12, 41, 23);

    var day1 = calendar.GetDayInChinese(dateTime);
    Assert.AreEqual("廿九", day1);

    var day2 = calendar.GetDayInChinese(dateTime, useNianFor20s: false);
    Assert.AreEqual("二十九", day2);
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated