Giter Club home page Giter Club logo

feiertagejs's Introduction

Feiertage.js

npm version Build Status

Feiertage.js is a small typescript npm module without dependencies to calculate German holidays for each Bundesland.

Installation

Quick Examples

ES Modules (Typescript/Javasript)

The prefered whay is to directly import the typescript module. However, you can also use .js. Please find here some examples and full api here.

import { getHolidays, isHoliday, isSpecificHoliday } from 'feiertagejs';

const today = new Date();

// is today a holiday?
isHoliday(today, 'BW'); // false --  probably false, because you are working ;)

// check if a day is a specific holiday
isSpecificHoliday(today, 'CHRISTIHIMMELFAHRT', 'ALL'); // true | false

// get all holiday for a single year: getHolidays()
// returns an array of "Holiday" Objects. Please see the docs.md for all properties.
const holidays2023 = getHolidays('2023', 'BUND');

holidays2023[0].date // === Date("2023-01-01");
holidays2023[0].name // 'NEUJAHRSTAG' (constant)
holidays2023[0].translate('de') // German translation: Neujahrstag
holidays2023[0].equals(date) // Compare days only (ignore time)

One entry of the array contains:

[{
    name: 'CHRISTIHIMMELFAHRT',
    date: new Date('2023-05-17T22:00:00.000Z'),
    dateString: '2023-05-18',
    regions: [
      'BW',  'BY',   'BE',
      'BB',  'HB',   'HE',
      'HH',  'MV',   'NI',
      'NW',  'RP',   'SL',
      'SN',  'ST',   'SH',
      'TH',  'BUND', 'AUGSBURG',
      'ALL'
    ],
    translate: [Function: translate],
    getNormalizedDate: [Function: getNormalizedDate],
    equals: [Function: equals]
  }
]

API doc

The full API doc can be found here.

Feedback and Questions

You have two options two give feedback or ask questions:

  • Comment the official release post
  • Open issues or pullrequests on github

Contributors

Thank you for contributing:

  • thetric
  • SteveOswald

Feedback

If you have any questions, feel free to open an issue.

feiertagejs's People

Contributors

sfakir avatar thetric avatar dependabot[bot] avatar steveoswald avatar gpa avatar jeyemwey avatar mschutt avatar stefpb avatar thomaskoscheck avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.