Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tinohager committed Oct 21, 2024
1 parent 968dd80 commit 0ca8c35
Show file tree
Hide file tree
Showing 15 changed files with 919 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: nager
42 changes: 42 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build, Test & Publish

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

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
working-directory: ./src
run: dotnet restore
- name: Build
working-directory: ./src
run: dotnet build --configuration Release --no-restore
- name: Test
working-directory: ./src
run: |
dotnet test --configuration Release --no-restore --no-build --verbosity normal
- name: Build project and generate NuGet package
run: |
dotnet pack --configuration Release --output $GITHUB_WORKSPACE/out src/Nager.LongWeekend/Nager.LongWeekend.csproj
- name: Push NuGet package
if: github.event_name != 'pull_request'
run: |
cd $GITHUB_WORKSPACE/out
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Nager.LongWeekend

Nager.LongWeekend is an open-source project designed to calculate potential long weekends based on public holidays.
By providing a list of holidays, it determines where extended weekends are possible.

## nuget

The package is available on [nuget](https://www.nuget.org/packages/Nager.LongWeekend)
```
PM> install-package Nager.LongWeekend
```

## Example

```cs
var holidays = new HolidayRecord[]
{
new HolidayRecord
{
Date = new DateOnly(2020, 01, 10),
Name = "Holiday Friday"
},
new HolidayRecord
{
Date = new DateOnly(2020, 01, 13),
Name = "Holiday Monday"
}
};

var weekendDays = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday };
var availableBridgeDays = 1;

var longWeekendCalculator = new LongWeekendCalculator(holidays, weekendDays);
var longWeekends = longWeekendCalculator.Calculate(availableBridgeDays);
```
1 change: 1 addition & 0 deletions src/Nager.LongWeekend.UnitTest/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using Microsoft.VisualStudio.TestTools.UnitTesting;
Loading

0 comments on commit 0ca8c35

Please sign in to comment.