This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including swedish-holidays
with all npm
packages installed. Try it out:
const { getHolidays, getUpcomingHolidays, isHoliday, language } = require('swedish-holidays');
// Get an array of all holidays for the current
const holidays = getHolidays();
// Get an array of all holidays for a specific year
const holidays2019 = getHolidays(2019);
// Get an array of all upcoming holidays
const upcoming = getUpcomingHolidays();
// Check if today is a holiday
const isItAHolidayToday = isHoliday();
// Or if you want to check a specific date
const isThisAHoliday = isHoliday(new Date("2019-12-24"));
// Create a translation
const translation = { ...language };
translation.christmasEve = 'Christmas Eve';
// Get an array of holidays with applied translation
const holidays2020 = getHolidays(2020, translation);
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.