kenya-holidays
v1.0.1
Published
A simple package to retrieve all Kenyan public holidays for a given year
Maintainers
Readme
Kenya Holidays
A simple npm package to get all Kenyan public holidays for a given year.
Installation
npm install kenya-holidaysUsage
Basic Usage
const { getKenyanHolidays } = require('kenya-holidays');
// Get holidays for the current year
const holidays = getKenyanHolidays();
console.log(holidays);
// Get holidays for a specific year
const holidays2024 = getKenyanHolidays(2024);
console.log(holidays2024);
// Get formatted dates (YYYY-MM-DD)
const formattedHolidays = getKenyanHolidays(null, true);
console.log(formattedHolidays);Detailed Holiday Information
const { getDetailedKenyanHolidays } = require('kenya-holidays');
// Get detailed holiday information for the current year
const detailedHolidays = getDetailedKenyanHolidays();
console.log(detailedHolidays);
// Example output:
// [
// {
// name: "New Year's Day",
// date: "2025-01-01",
// type: "National",
// description: "Celebrates the start of the new year",
// isVariable: false
// },
// ...
// ]Check if a Date is a Holiday
const { isKenyanHoliday } = require('kenya-holidays');
// Check if a specific date is a holiday
const holiday = isKenyanHoliday('2025-12-25');
if (holiday) {
console.log(`${holiday.date} is ${holiday.name} (${holiday.type})`);
console.log(`Description: ${holiday.description}`);
} else {
console.log('Not a holiday');
}
// You can also pass a Date object
const dateObj = new Date(2025, 11, 25); // December 25, 2025
const christmasHoliday = isKenyanHoliday(dateObj);
console.log(christmasHoliday); // Returns holiday infoFeatures
- Get all Kenyan public holidays for any year (past, present, or future)
- Accurately calculates Easter-based holidays (Good Friday, Easter Monday) for any year
- Option to get dates in JavaScript Date objects or formatted strings
- Notes for variable Islamic holidays (Eid al-Fitr, Eid al-Adha)
- Detailed holiday information including type and description
- Flexible API with both simple and detailed output formats
Holiday List
The package includes the following Kenyan public holidays:
- New Year's Day - January 1
- Good Friday - Variable date (calculated)
- Easter Monday - Variable date (calculated)
- Labour Day - May 1
- Madaraka Day - June 1
- Huduma Day - October 10
- Mashujaa Day - October 20
- Jamhuri Day - December 12
- Christmas Day - December 25
- Boxing Day - December 26
- Utamaduni Day - December 27
- Eid al-Fitr* - Variable date (Islamic calendar)
- Eid al-Adha* - Variable date (Islamic calendar)
- Diwali* - Variable date (sometimes declared a public holiday)
*Note: Islamic holidays depend on the lunar calendar and may vary. The package provides a note for these dates rather than calculating them.
License
MIT
