New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

moment-feiertage

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-feiertage

Moment.js Plugin for german holidays; check if a given Date is a german holiday

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
399
increased by11.76%
Maintainers
1
Weekly downloads
 
Created
Source

moment-feiertage

moment-feiertage is a Moment.js plugin to determine if a date is a german holiday. Holidays are taken from Wikipedia (de).

How to use?

  1. Add moment-feiertage to your package.json by runing npm install moment-feiertage --save
  2. Import moment and moment-feiertage
// ES6
import moment from 'moment'
import 'moment-feiertage'

// node
const moment = require('moment');
const { isHoliday } = require('moment-feiertage');
  1. isHoliday() on any moment object is returning false (boolean) or name of holiday (string)

Examples

/**
 * isHoliday() checks if moment object is a german holiday in all states.
 * isHoliday('<state code>') checks if moment object is a german holiday in specific state)
 * @param {string} input any state code
 * @returns {number|string} false | name of holiday
 */

const nowIsHoliday = moment().isHoliday();
const someDateIsHoliday = moment('2019-12-25').isHoliday();
// returns '1. Weihnachtsfeiertag' - is holiday in all states

const isHolidayInAllStates = moment('2017-08-15').isHoliday();
// returns false - is not holiday in all states

const isHolidayInBavaria = moment('2017-08-15').isHoliday('BY');
// returns false - is not holiday in BY

const isHolidayInSaarland = moment('2017-08-15').isHoliday('SL');
// returns 'Mariä Himmelfahrt' - is holiday in SL

// state codes:
// BW = Baden-Württemberg
// BY = Bayern
// BE = Berlin
// BB = Brandenburg
// HB = Bremen
// HH = Hamburg
// HE = Hessen
// MV = Mecklenburg-Vorpommern
// NI = Niedersachsen
// NW = Nordrhein-Westfalen
// RP = Rheinland-Pfalz
// SL = Saarland
// SN = Sachsen
// ST = Sachsen-Anhalt
// SH = Schleswig-Holstein
// TH = Thüringen

Keywords

FAQs

Package last updated on 26 Jun 2018

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