Skip to content

Latest commit

 

History

History
41 lines (33 loc) · 1.22 KB

File metadata and controls

41 lines (33 loc) · 1.22 KB

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