Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swedish-holidays

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swedish-holidays

Library for calculating the date of all swedish holidays for any given year.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
decreased by-7.5%
Maintainers
1
Weekly downloads
 
Created
Source

swedish-holidays

Library for calculating the date of all swedish holidays for any given year.

How to install:

npm install swedish-holidays

How to use:

const { getHolidays, getUpcomingHolidays, isHoliday } = 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")); 

The result will always be an Array filled with JSON formatted holiday information including name and date.

[
    {
        name: 'Julafton',
        date: 2019-12-24T00:00:00.000Z,
        day: 24,
        month: 12,
        year: 2019
    },
    {
        name: 'Juldagen',
        date: 2019-12-25T00:00:00.000Z,
        day: 25,
        month: 12,
        year: 2019
    },
    ...
]   

When using isHoliday the result is true or false.

Limitations

This library can only return valid holidays for years between 1582 to 8702.

If an invalid year is requested, some holidays will be missing.

Supported Holidays

  • Nyårsdagen
  • Trettondagsafton
  • Trettondedag jul
  • Skärtorsdagen
  • Långfredagen
  • Påskafton
  • Påskdagen
  • Annandag påsk
  • Valborgsmässoafton
  • Första maj
  • Kristi himmelsfärdsdag
  • Sveriges nationaldag
  • Pingstafton
  • Pingstdagen
  • Midsommarafton
  • Midsommardagen
  • Allhelgonaafton
  • Alla helgons dag
  • Julafton
  • Juldagen
  • Annandag jul
  • Nyårsafton

Keywords

FAQs

Package last updated on 18 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc