@mohamed_irfan/lanka-calendar
v1.0.4
Published
Sri Lankan holiday and calendar utility package with Poya days, public holidays, bank holidays, and business day calculations.
Maintainers
Readme
@mohamed_irfan/lanka-calendar
A comprehensive Sri Lankan holiday and calendar utility for Node.js and JavaScript applications.
Overview
@mohamed_irfan/lanka-calendar provides accurate, up-to-date Sri Lankan public holiday data with utilities for holiday detection, business day calculations, and calendar generation. Holiday data is sourced from official Sri Lankan government and Central Bank publications and covers 2019 through 2026.
Installation
npm install @mohamed_irfan/lanka-calendarFeatures
| Feature | Description | |---|---| | Holiday detection | Public, bank, and mercantile holidays | | Poya days | Full moon Poya day detection | | Business day checks | Accounts for weekends and all holiday types | | Weekend detection | Saturday and Sunday checks | | Calendar generation | Monthly and yearly calendar objects | | Multi-holiday support | Multiple holidays on the same date | | Holiday metadata | Category, religion, status, source, and localized names | | Fast lookups | JSON-based data for minimal overhead | | ES Module support | Works with modern import/export syntax |
Import
import {
getHolidays,
getHolidaysByDate,
getHolidayInfo,
isHoliday,
isWeekend,
isBusinessDay,
isPublicHoliday,
isBankHoliday,
isMercantileHoliday,
isPoyaDay,
createCalendarMonth,
createCalendarYear,
} from "@mohamed_irfan/lanka-calendar";API Reference
getHolidays(year)
Returns all holidays for a given year.
const holidays = getHolidays(2025);getHolidaysByDate(date)
Returns all holidays on a specific date. Supports multiple holidays on the same date.
const holidays = getHolidaysByDate("2025-05-12");getHolidayInfo(date)
Returns metadata for the first holiday found on a given date.
const info = getHolidayInfo("2025-05-12");isHoliday(date)
Returns true if the given date is any type of holiday.
isHoliday("2025-05-12"); // trueisWeekend(date)
Returns true if the given date falls on a Saturday or Sunday.
isWeekend("2025-05-10"); // trueisBusinessDay(date)
Returns true if the given date is neither a weekend nor a holiday.
isBusinessDay("2025-05-12"); // falseisPublicHoliday(date)
Returns true if the given date is a declared public holiday.
isPublicHoliday("2025-02-04"); // trueisBankHoliday(date)
Returns true if the given date is a bank holiday.
isBankHoliday("2025-02-04"); // trueisMercantileHoliday(date)
Returns true if the given date is a mercantile holiday.
isMercantileHoliday("2025-02-04"); // trueisPoyaDay(date)
Returns true if the given date is a full moon Poya day.
isPoyaDay("2025-05-12"); // truecreateCalendarMonth(year, month)
Generates a calendar array for the given month, where each element is a Calendar Day object.
const may2025 = createCalendarMonth(2025, 5);createCalendarYear(year)
Generates a full calendar for the given year, organized by month.
const calendar2025 = createCalendarYear(2025);Data Structures
Calendar Day Object
Each day in a generated calendar is represented as:
{
date: "2025-05-12",
year: 2025,
month: 5,
day: 12,
dayName: "Monday",
isToday: false,
isWeekend: false,
isHoliday: true,
isPublicHoliday: true,
isBankHoliday: true,
isMercantileHoliday: true,
isPoyaDay: true,
isBusinessDay: false,
holidays: [...], // Array of Holiday objects
holiday: {...} // First Holiday object (convenience accessor)
}Holiday Object
{
id: "2025-vesak-full-moon-poya-day",
name: "Vesak Full Moon Poya Day",
date: "2025-05-12",
year: 2025,
month: 5,
day: 12,
day_name: "Monday",
type: ["Bank", "Public", "Mercantile"],
category: "religious",
religion: "Buddhism",
is_poya: true,
is_public_holiday: true,
is_bank_holiday: true,
is_mercantile_holiday: true,
status: "confirmed",
is_tentative: false,
may_change: false,
names: {
en: "Vesak Full Moon Poya Day",
si: null,
ta: null
},
source: {
name: "Central Bank of Sri Lanka",
url: "https://www.cbsl.gov.lk"
},
last_updated: "2026-05-21"
}Supported Years
Holiday data is available for the following years:
2019 · 2020 · 2021 · 2022 · 2023 · 2024 · 2025 · 2026
Support for additional years will be added in future releases.
Data Source
Holiday data is derived from official Sri Lankan government publications and the Central Bank of Sri Lanka.
Primary source: https://www.cbsl.gov.lk
Notes
- Some Islamic holidays may vary by up to a day depending on moon sighting confirmation.
- Dates for future years are based on official announcements and may be subject to change.
- Multiple holidays on the same date are fully supported; use
getHolidaysByDate()to retrieve all.
License
MIT © Mohamed Irfan
Author
Mohamed Irfan
