rwa-holidays
NPM package for getting Rwanda holidays for a given year or determine if current date is a holiday, it also shifts holidays when actual holiday happens in weekend
Installation
npm install rwa-holidays
yarn add rwa-holidays
Usage
To get a list of all Rwanda holidays in a given year, use the getHolidays
method. If no year is passed in, it uses the current year.
const { getHolidays } = require('rwa-holidays');
const holidays = getHolidays(2020);
[
{
name: 'Genocide against the Tutsi Memorial Day',
date: 2020-04-07T00:00:00.000Z,
dateString: '2020-4-7'
},
{
name: 'Liberation Day',
date: 2020-07-03T00:00:00.000Z,
dateString: '2020-7-3'
},
{
name: 'National Heroes Day',
date: 2020-01-31T00:00:00.000Z,
dateString: '2020-1-31'
},
{
name: "New Year's Day",
date: 2020-01-01T00:00:00.000Z,
dateString: '2020-1-1'
},
{
name: 'Day after New Year’ s Day',
date: 2020-01-02T00:00:00.000Z,
dateString: '2020-1-2'
},
{
name: 'Labor Day',
date: 2020-05-01T00:00:00.000Z,
dateString: '2020-5-1'
},
{
name: 'Independence Day',
date: 2020-07-01T00:00:00.000Z,
dateString: '2020-7-1'
},
{
name: 'Assumption Day',
date: 2020-08-14T00:00:00.000Z,
dateString: '2020-8-14'
},
{
name: 'Christmas Day',
date: 2020-12-25T00:00:00.000Z,
dateString: '2020-12-25'
},
{
name: 'Boxing Day',
date: 2020-12-25T00:00:00.000Z,
dateString: '2020-12-25'
},
{
name: 'Umuganura Day',
date: 2020-08-07T00:00:00.000Z,
dateString: '2020-8-7'
}
]
Find if a date is a holiday, use the isAHoliday
method. If no argument is provided, defaults to the current date:
const { isAHoliday } = require("rwa-holidays");
const options = {
utc: false
};
const isAHoliday = isAHoliday(my_date, options);
For holidays that fall on Saturdays holidays are shifted to Friday:
const { isAHoliday } = require("rwa-holidays");
console.log(isHoliday(new Date("2010-12-25")));
console.log(isHoliday(new Date("2010-12-24")));
For holidays that fall on Sundays holidays are shifted to Monday:
const { isAHoliday } = require("rwa-holidays");
console.log(isHoliday(new Date("2005-12-25")));
console.log(isHoliday(new Date("2005-12-26")));
Contribution
License
MIT
Author
Igwaneza Bruce