Skip to content

Commit

Permalink
增加2024年假期
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 31, 2023
1 parent c645604 commit c77a532
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 16 deletions.
16 changes: 16 additions & 0 deletions NewLife.Holiday/China/2024.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Name,Date,Days,Status
元旦,2023/12/30,3,1
春节,2024/2/10,8,1
春节,2024/2/4,1,2
春节,2024/2/18,1,2
清明节,2024/4/4,3,1
清明节,2024/4/7,1,2
劳动节,2024/5/1,5,1
劳动节,2024/4/28,1,2
劳动节,2024/5/11,1,2
端午节,2024/6/8,3,1
中秋节,2024/9/15,3,1
中秋节,2024/9/14,1,2
国庆节,2024/10/1,7,1
国庆节,2024/9/29,1,2
国庆节,2024/10/12,1,2
4 changes: 2 additions & 2 deletions NewLife.Holiday/Guangxi/2022.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Name,Date,Days,Status
三月三,2022/4/3,3,1
三月三,2022/4/2,1,1
三月三,2022/4/6,1,1
三月三,2022/4/2,1,2
三月三,2022/4/6,1,2
3 changes: 1 addition & 2 deletions NewLife.Holiday/Guangxi/2023.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Name,Date,Days,Status
三月三,2023/4/14,3,1
三月三,2023/4/18,1,2
三月三,2023/4/21,3,1
2 changes: 2 additions & 0 deletions NewLife.Holiday/Guangxi/2024.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name,Date,Days,Status
三月三,2024/4/11,2,1
4 changes: 2 additions & 2 deletions NewLife.Holiday/HolidayExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static class HolidayExtensions
/// <summary>广西假期</summary>
public static IHoliday Guangxi { get; set; } = new GuangxiHoliday();

/// <summary>是否中国假期</summary>
/// <summary>是否中国假期(放假无需上班)</summary>
/// <param name="date"></param>
/// <returns></returns>
public static Boolean IsChinaHoliday(this DateTime date)
Expand All @@ -33,7 +33,7 @@ public static Boolean IsChinaHoliday(this DateTime date)
return date.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday;
}

/// <summary>是否广西假期</summary>
/// <summary>是否广西假期(放假无需上班)</summary>
/// <param name="date"></param>
/// <returns></returns>
public static Boolean IsGuangxiHoliday(this DateTime date)
Expand Down
7 changes: 6 additions & 1 deletion NewLife.Holiday/NewLife.Holiday.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.2.2023.401" />
<PackageReference Include="NewLife.Core" Version="10.6.2023.1001" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="China\**\*" />
<EmbeddedResource Include="Guangxi\**\*" />
</ItemGroup>

<ItemGroup>
<None Remove="China\2024.csv" />
<None Remove="Guangxi\2024.csv" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.2.2023.401" />
<PackageReference Include="NewLife.Core" Version="10.6.2023.1001" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NewLife.Holiday\NewLife.Holiday.csproj" />
Expand Down
5 changes: 3 additions & 2 deletions XUnitTest/GuangxiHolidayTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ public class GuangxiHolidayTests
{
[Theory]
[InlineData("2022/4/3")]
[InlineData("2023/4/14")]
[InlineData("2022/4/2")]
[InlineData("2023/4/22")]
[InlineData("2023/4/23")]
[InlineData("2022/4/5")]
public void Test广西三月三(String date)
{
var dt = date.ToDateTime();
Expand Down
18 changes: 18 additions & 0 deletions XUnitTest/HolidayTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,22 @@ public void Test中秋节(String date)
Assert.Equal("中秋节", hi.Name);
Assert.True(inf.Days >= 1);
}

[Theory]
[InlineData("2023/9/23")]
[InlineData("2023/9/24")]
public void Test周末(String date)
{
var dt = date.ToDateTime();
var rs = dt.IsChinaHoliday();

Assert.True(rs);

var infs = HolidayExtensions.China.Query(dt).ToList();
Assert.Empty(infs);
//foreach (var item in infs)
//{
// Assert.Equal(HolidayStatus.Normal, item.Status);
//}
}
}
12 changes: 6 additions & 6 deletions XUnitTest/XUnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NewLife.Core" Version="10.2.2023.401" />
<PackageReference Include="NewLife.UnitTest" Version="1.0.2022.901" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="NewLife.Core" Version="10.6.2023.1001" />
<PackageReference Include="NewLife.UnitTest" Version="1.0.2023.905" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit c77a532

Please sign in to comment.