Skip to content

Commit

Permalink
Merge branch 'nager:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
BelmoMusta authored Dec 25, 2024
2 parents c941445 + 03fbf73 commit 898164e
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 35 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,18 @@ updates:
- "enhancement"
# Allow up to 5 open pull requests for nuget dependencies
open-pull-requests-limit: 5

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "daily"
reviewers:
- "tinohager"
- "samtrion"
commit-message:
prefix: chore
labels:
- "dependencies"
- "enhancement"
# Allow up to 5 open pull requests for nuget dependencies
open-pull-requests-limit: 5
26 changes: 26 additions & 0 deletions .github/workflows/dependabot-github-actions-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Dependabot GitHub Actions Auto Merge

on:
pull_request:
paths:
- '.github/workflows/**'
branches: [ main ]

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
1 change: 1 addition & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
pull_request:
paths:
- 'src/**'
- '.github/workflows/**'
branches: [ main ]

jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
<PackageReference Include="TngTech.ArchUnitNET.MSTestV2" Version="0.11.1" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/Nager.Date.UnitTest/Nager.Date.UnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 1 addition & 5 deletions src/Nager.Date/HolidayProviders/AustraliaHolidayProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
var firstMondayInOctober = DateHelper.FindDay(year, Month.October, DayOfWeek.Monday, Occurrence.First);
var firstTuesdayInNovember = DateHelper.FindDay(year, Month.November, DayOfWeek.Tuesday, Occurrence.First);

//var newYearsDay = new DateTime(year, 1, 1).Shift(saturday => saturday.AddDays(2), sunday => sunday.AddDays(1));
//var christmasDay = new DateTime(year, 12, 25).Shift(saturday => saturday.AddDays(2), sunday => sunday.AddDays(2));
//var boxingDay = new DateTime(year, 12, 26).Shift(saturday => saturday.AddDays(2), sunday => sunday.AddDays(2));
//var australiaDay = new DateTime(year, 1, 26).Shift(saturday => saturday.AddDays(2), sunday => sunday.AddDays(1));

var weekendObservedRuleSet = new ObservedRuleSet
{
Saturday = date => date.AddDays(2), Sunday = date => date.AddDays(1),
Expand Down Expand Up @@ -332,6 +327,7 @@ private HolidaySpecification[] MonarchBirthday(int year)
case 2019:
case 2021:
case 2023:
case 2024:
{
var lastFridayInSeptember = DateHelper.FindLastDay(year, Month.September, DayOfWeek.Friday);

Expand Down
18 changes: 18 additions & 0 deletions src/Nager.Date/HolidayProviders/GermanyHolidayProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,30 @@ private HolidaySpecification ReformationDay(int year)
return null;
}

private HolidaySpecification? UprisingOfJune171953(int year)
{
if (year == 2028)
{
return new HolidaySpecification
{
Date = new DateTime(year, 5, 8),
EnglishName = "75th anniversary of the uprising of June 17, 1953",
LocalName = "75. Jahrestag des Aufstandes vom 17. Juni 1953",
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["DE-BE"]
};
}

return null;
}

/// <inheritdoc/>
public override IEnumerable<string> GetSources()
{
return
[
"https://de.wikipedia.org/wiki/Gesetzliche_Feiertage_in_Deutschland",
"https://pardok.parlament-berlin.de/starweb/adis/citat/VT/19/gvbl/g24280460.pdf"
];
}
}
Expand Down
92 changes: 68 additions & 24 deletions src/Nager.Date/HolidayProviders/SwitzerlandHolidayProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
Date = new DateTime(year, 6, 29),
EnglishName = "Saints Peter and Paul",
LocalName = "Peter und Paul",
HolidayTypes = HolidayTypes.Public,
HolidayTypes = HolidayTypes.Observance,
SubdivisionCodes = ["CH-TI"]
},
new HolidaySpecification
Expand All @@ -105,22 +105,6 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
HolidayTypes = HolidayTypes.Public
},
new HolidaySpecification
{
Date = new DateTime(year, 8, 15),
EnglishName = "Assumption of the Virgin Mary",
LocalName = "Maria Himmelfahrt",
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-LU", "CH-UR", "CH-SZ", "CH-OW", "CH-NW", "CH-ZG", "CH-FR", "CH-SO", "CH-BL", "CH-AI", "CH-GR", "CH-AG", "CH-TI", "CH-VS", "CH-JU"]
},
new HolidaySpecification
{
Date = new DateTime(year, 11, 1),
EnglishName = "All Saints' Day",
LocalName = "Allerheiligen",
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-LU", "CH-UR", "CH-SZ", "CH-OW", "CH-NW", "CH-GL", "CH-ZG", "CH-FR", "CH-SO", "CH-AI", "CH-SG", "CH-GR", "CH-AG", "CH-TI", "CH-VS", "CH-JU"]
},
new HolidaySpecification
{
Date = new DateTime(year, 12, 25),
EnglishName = "Christmas Day",
Expand Down Expand Up @@ -151,6 +135,14 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-VD"]
},
new HolidaySpecification
{
Date = new DateTime(year, 12, 31),
EnglishName = "Restoration Day",
LocalName = "Restauration de la République",
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-GE"]
},
this._catholicProvider.GoodFriday("Karfreitag", year).SetSubdivisionCodes("CH-ZH", "CH-BE", "CH-LU", "CH-UR", "CH-SZ", "CH-OW", "CH-NW", "CH-GL", "CH-ZG", "CH-FR", "CH-SO", "CH-BS", "CH-BL", "CH-SH", "CH-AR", "CH-AI", "CH-SG", "CH-GR", "CH-AG", "CH-TG", "CH-VD", "CH-NE", "CH-GE", "CH-JU"),
this._catholicProvider.AscensionDay("Auffahrt", year),
};
Expand All @@ -161,6 +153,8 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
holidaySpecifications.AddRangeIfNotNull(this.WhitMonday(year));
holidaySpecifications.AddRangeIfNotNull(this.EasterMonday(year));
holidaySpecifications.AddRangeIfNotNull(this.Epiphany(year));
holidaySpecifications.AddRange(this.AssumptionOfTheVirginMary(year));
holidaySpecifications.AddRange(this.AllSaintsDay(year));
holidaySpecifications.AddIfNotNull(this.BerchtoldsDay(year));
holidaySpecifications.AddRangeIfNotNull(this.SaintJosephsDay(year));
holidaySpecifications.AddRangeIfNotNull(this.CorpusChristi(year));
Expand Down Expand Up @@ -194,12 +188,37 @@ private HolidaySpecification[] Epiphany(int year)
];
}

private HolidaySpecification[] AssumptionOfTheVirginMary(int year)
{
var englishName = "Assumption of the Virgin Mary";
var localName = "Maria Himmelfahrt";

return
[
new HolidaySpecification
{
Date = new DateTime(year, 8, 15),
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-LU", "CH-UR", "CH-SZ", "CH-OW", "CH-NW", "CH-ZG", "CH-FR", "CH-SO", "CH-AG", "CH-TI", "CH-VS"]
},
new HolidaySpecification
{
Date = new DateTime(year, 8, 15),
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Observance,
SubdivisionCodes = ["CH-AI", "CH-JU"]
}
];
}

private HolidaySpecification BerchtoldsDay(int year)
{
var subdivisionCodes = new List<string>(["CH-BE", "CH-FR", "CH-SH", "CH-AG", "CH-TG", "CH-VD"]);

if (new DateTime(year, 1, 1).DayOfWeek == DayOfWeek.Sunday ||
new DateTime(year, 12, 25).DayOfWeek == DayOfWeek.Sunday)
if (new DateTime(year, 1, 1).DayOfWeek == DayOfWeek.Sunday)
{
subdivisionCodes.Add("CH-NE");
}
Expand Down Expand Up @@ -240,6 +259,32 @@ private HolidaySpecification[] SaintJosephsDay(int year)
];
}

private HolidaySpecification[] AllSaintsDay(int year)
{
var englishName = "All Saints' Day";
var localName = "Allerheiligen";

return
[
new HolidaySpecification
{
Date = new DateTime(year, 11, 1),
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-LU", "CH-UR", "CH-SZ", "CH-OW", "CH-NW", "CH-GL", "CH-ZG", "CH-FR", "CH-SO", "CH-SG", "CH-AG", "CH-TI", "CH-VS"]
},
new HolidaySpecification
{
Date = new DateTime(year, 11, 1),
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Observance,
SubdivisionCodes = ["CH-AI", "CH-JU"]
}
];
}

private HolidaySpecification[] EasterMonday(int year)
{
var localName = "Ostermontag";
Expand Down Expand Up @@ -295,15 +340,15 @@ private HolidaySpecification[] ImmaculateConception(int year)
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-LU", "CH-UR", "CH-SZ", "CH-OW", "CH-NW", "CH-ZG", "CH-FR", "CH-SO", "CH-AG", "CH-TI", "CH-VS"]
SubdivisionCodes = ["CH-UR", "CH-OW", "CH-NW", "CH-ZG", "CH-FR", "CH-AG", "CH-VS"]
},
new HolidaySpecification
{
Date = new DateTime(year, 12, 8),
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Observance,
SubdivisionCodes = ["CH-AI", "CH-JU"]
SubdivisionCodes = ["CH-AI", "CH-JU", "CH-LU", "CH-SZ", "CH-TI"]
}
];
}
Expand All @@ -321,7 +366,7 @@ private HolidaySpecification[] LabourDay(int year)
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-ZH", "CH-SO", "CH-BS", "CH-BL", "CH-SH", "CH-AG", "CH-NE", "CH-JU"]
SubdivisionCodes = ["CH-ZH", "CH-SO", "CH-BS", "CH-BL", "CH-SH", "CH-NE", "CH-JU"]
},
new HolidaySpecification
{
Expand All @@ -347,8 +392,7 @@ private HolidaySpecification[] StephensDay(int year)
subdivisionCodes.AddRange(["CH-AR", "CH-AI"]);
}

if (new DateTime(year, 1, 1).DayOfWeek == DayOfWeek.Sunday ||
new DateTime(year, 12, 25).DayOfWeek == DayOfWeek.Sunday)
if (new DateTime(year, 12, 25).DayOfWeek == DayOfWeek.Sunday)
{
subdivisionCodes.Add("CH-NE");
}
Expand Down

0 comments on commit 898164e

Please sign in to comment.