SriLankaHolidays 1.1.2

dotnet add package SriLankaHolidays --version 1.1.2
                    
NuGet\Install-Package SriLankaHolidays -Version 1.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SriLankaHolidays" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SriLankaHolidays" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="SriLankaHolidays" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SriLankaHolidays --version 1.1.2
                    
#r "nuget: SriLankaHolidays, 1.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SriLankaHolidays@1.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SriLankaHolidays&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=SriLankaHolidays&version=1.1.2
                    
Install as a Cake Tool

🇱🇰 SriLankaHolidays for .NET (NuGet)

Official Sri Lanka Public, Bank, and Mercantile Holidays (including Full Moon Poya Days) for .NET 8+, with built-in 2026 and 2027 calendars and extensible JSON support for future years.


📦 Installation

dotnet add package SriLankaHolidays

🚀 Quick Start

using SriLankaHolidays;

// 1. Get all holidays for 2026 or 2027
var holidays2026 = SriLankaHolidayCalendar.GetHolidays(2026);
var holidays2027 = SriLankaHolidayCalendar.GetHolidays(2027);

// 2. Filter by Holiday Type (Public, Bank, Mercantile, or Poya)
var public2026 = SriLankaHolidayCalendar.GetPublicHolidays(2026);
var bank2026 = SriLankaHolidayCalendar.GetBankHolidays(2026);
var mercantile2027 = SriLankaHolidayCalendar.GetMercantileHolidays(2027);
var poyaDays2026 = SriLankaHolidayCalendar.GetPoyaDays(2026);

// 3. Get only the 8 statutory (non-Poya) Mercantile holidays
var statutoryMercantile = SriLankaHolidayCalendar.GetHolidays(
    year: 2027,
    type: HolidayType.Mercantile,
    isPoya: false
);

// 4. Check specific dates ('yyyy-MM-dd', DateOnly, or DateTime)
bool isPublic = SriLankaHolidayCalendar.IsPublicHoliday("2026-04-03");         // true (Good Friday)
bool isBank = SriLankaHolidayCalendar.IsBankHoliday("2026-04-03");             // true
bool isMercantile = SriLankaHolidayCalendar.IsMercantileHoliday("2026-04-03"); // false (Good Friday is NOT Mercantile)

// 5. DateOnly & DateTime Extension Methods
var newYear = new DateOnly(2026, 4, 14);
bool isMercantileNewYear = newYear.IsMercantileHoliday(); // true
var holidayInfo = newYear.GetSriLankaHoliday();
Console.WriteLine($"{holidayInfo?.Name} ({holidayInfo?.Day})"); // "Sinhala & Tamil New Year Day (Tuesday)"

// 6. Add future years via JSON at runtime (e.g., 2028)
SriLankaHolidayCalendar.AddHolidaysFromJson(2028, """
[
  {
    "date": "2028-01-15",
    "name": "Tamil Thai Pongal Day",
    "types": ["Public", "Bank", "Mercantile"]
  }
]
""");

🛠️ API Reference

Method Description
SriLankaHolidayCalendar.GetSupportedYears() Returns loaded years ([2026, 2027]).
SriLankaHolidayCalendar.GetHolidays(year?, month?, type?, isPoya?) Queries holidays with optional filters.
SriLankaHolidayCalendar.GetPublicHolidays(year?) Returns all Public holidays.
SriLankaHolidayCalendar.GetBankHolidays(year?) Returns all Bank holidays.
SriLankaHolidayCalendar.GetMercantileHolidays(year?) Returns all Mercantile holidays.
SriLankaHolidayCalendar.GetPoyaDays(year?) Returns all Full Moon Poya Days.
SriLankaHolidayCalendar.GetHolidayByDate(date) Returns SriLankaHoliday? for a string, DateOnly, or DateTime.
SriLankaHolidayCalendar.IsHoliday(date, type?) Checks if a date is a holiday (and optionally of a specific HolidayType).
SriLankaHolidayCalendar.AddHolidaysFromJson(year, json) Registers a new year from a JSON array string.

☕ Support & Donate

If you find this library helpful, consider supporting its maintenance: 👉 Buy Me a Coffee — https://buymeacoffee.com/rsahan

📄 License

MIT © Sahan Ranasingha

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.2 0 11/9/2026
1.0.2 0 11/9/2026