Skip to content

Lightweight .NET library to calculate potential long weekends based on public holidays. Supports custom weekend definitions, bridge days, and provides easy-to-use APIs.

License

Notifications You must be signed in to change notification settings

nager/Nager.LongWeekend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nager.LongWeekend

Nager.LongWeekend is a lightweight, open-source .NET library that helps you calculate potential long weekends based on public holidays.
By providing a list of holidays and your defined weekend days, the library determines possible extended weekends — including those that can be created with optional bridge days.

✨ Features

  • Detects long weekends based on given holiday data.
  • Supports custom weekend definitions (not just Saturday/Sunday).
  • Considers bridge days to extend weekends.
  • Simple API with minimal dependencies.

📦 Installation

The package is available on NuGet

PM> install-package Nager.LongWeekend

🚀 Usage Examples

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);

About

Lightweight .NET library to calculate potential long weekends based on public holidays. Supports custom weekend definitions, bridge days, and provides easy-to-use APIs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages