Help Page Aktualisiert

Die Hilfe Seite wurde auf den neusten Stand gebracht, auf der Login Page entfernt und hat einen Back button bekommen
This commit is contained in:
AliGitGut
2023-06-19 15:29:56 +02:00
parent 571e6e72c0
commit a0841f4b2b
26 changed files with 91399 additions and 37 deletions
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+158
View File
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="744e9299-0ce3-415c-8733-c935bf920887" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/anwendung/src/images/screen2.png" beforeDir="false" afterPath="$PROJECT_DIR$/anwendung/src/images/screen2.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/anwendung/src/images/screen3.png" beforeDir="false" afterPath="$PROJECT_DIR$/anwendung/src/images/screen3.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/anwendung/src/images/screen5.png" beforeDir="false" afterPath="$PROJECT_DIR$/anwendung/src/images/screen5.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/anwendung/src/pages/help.js" beforeDir="false" afterPath="$PROJECT_DIR$/anwendung/src/pages/help.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/anwendung/src/pages/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/anwendung/src/pages/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/backend/database.mv.db" beforeDir="false" afterPath="$PROJECT_DIR$/backend/database.mv.db" afterDir="false" />
<change beforePath="$PROJECT_DIR$/backend/database.trace.db" beforeDir="false" afterPath="$PROJECT_DIR$/backend/database.trace.db" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="CSS File" />
<option value="JavaScript File" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2PV5k9t8lC9xvqgtEIMZ2TApWUu" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;list.type.of.created.stylesheet&quot;: &quot;CSS&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;ts.external.directory.path&quot;: &quot;C:\\Users\\afist\\AppData\\Local\\JetBrains\\Toolbox\\apps\\WebStorm\\ch-0\\231.8770.64\\plugins\\javascript-impl\\jsLanguageServicesImpl\\external&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\TIF22A_AnwProjekt_B\anwendung\src\images" />
</key>
</component>
<component name="RunManager" selected="npm.dev">
<configuration name="index.js" type="NodeJSConfigurationType" temporary="true" nameIsGenerated="true" path-to-js-file="index.js" working-dir="$PROJECT_DIR$/anwendung/src/pages">
<method v="2" />
</configuration>
<configuration name="build" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/anwendung/package.json" />
<command value="run" />
<scripts>
<script value="build" />
</scripts>
<node-interpreter value="node" />
<envs />
<method v="2" />
</configuration>
<configuration name="dev" type="js.build_tools.npm" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/anwendung/package.json" />
<command value="run" />
<scripts>
<script value="dev" />
</scripts>
<node-interpreter value="node" />
<package-manager value="npm" />
<envs />
<method v="2">
<option name="NpmBeforeRunTask" enabled="true">
<package-json value="$PROJECT_DIR$/anwendung/package.json" />
<command value="run" />
<scripts>
<script value="build" />
</scripts>
<node-interpreter value="node" />
<package-manager value="npm" />
<envs />
</option>
</method>
</configuration>
<list>
<item itemvalue="Node.js.index.js" />
<item itemvalue="npm.build" />
<item itemvalue="npm.dev" />
</list>
<recent_temporary>
<list>
<item itemvalue="Node.js.index.js" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="744e9299-0ce3-415c-8733-c935bf920887" name="Changes" comment="" />
<created>1683529551159</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1683529551159</updated>
<workItem from="1683529552463" duration="1756000" />
<workItem from="1683830457997" duration="1285000" />
<workItem from="1684223646646" duration="1195000" />
<workItem from="1684228236564" duration="1017000" />
<workItem from="1684257831013" duration="1011000" />
<workItem from="1684267194850" duration="890000" />
<workItem from="1684672228161" duration="1603000" />
<workItem from="1684788345629" duration="1507000" />
<workItem from="1684856925307" duration="3000" />
<workItem from="1684856964097" duration="5995000" />
<workItem from="1684915449317" duration="9318000" />
<workItem from="1685011281036" duration="2214000" />
<workItem from="1685055429281" duration="634000" />
<workItem from="1685103879210" duration="2066000" />
<workItem from="1685142372079" duration="5289000" />
<workItem from="1685311018550" duration="2063000" />
<workItem from="1685356323722" duration="4005000" />
<workItem from="1685389394962" duration="4465000" />
<workItem from="1685439319096" duration="492000" />
<workItem from="1686165563810" duration="18166000" />
<workItem from="1686259026223" duration="2970000" />
<workItem from="1686313568230" duration="1725000" />
<workItem from="1686331195896" duration="7520000" />
<workItem from="1686345244271" duration="7553000" />
<workItem from="1686572559048" duration="4289000" />
<workItem from="1686655739777" duration="3725000" />
<workItem from="1686659590430" duration="2344000" />
<workItem from="1686690018802" duration="32000" />
<workItem from="1686690072078" duration="307000" />
<workItem from="1686727178400" duration="9281000" />
<workItem from="1686825740350" duration="2964000" />
<workItem from="1686831091729" duration="595000" />
<workItem from="1686906198799" duration="2151000" />
<workItem from="1686910129813" duration="1653000" />
<workItem from="1686923077769" duration="3441000" />
<workItem from="1687173723149" duration="7011000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
</project>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 19 KiB

+36 -36
View File
@@ -15,27 +15,26 @@ export default function Help(p)
return ( return (
<div> <div>
<Back onClick={() => router.back()}/>
<div className={"help-line"}> <div className={"help-line"}>
<img src={screen1.src}/> <img src={screen1.src}/>
<div className={"text-form"}> <div className={"text-form"}>
<h1>Die Monats-Seiten-Leiste</h1> <h1>Die Monats-Leiste</h1>
<p>- Hier kannst du sehen in welchem Monat du dich aktuell befindest (blau hinterlegt).</p> <p>- Hier sehen Sie in welchem Monat Sie sich aktuell befinden (blau hinterlegt)</p>
<p>- Durch einen Links-Klick auf eine Monatskacheln kannst du direkt an den Anfang dieses Monats springen</p> <p>- Durch einen Links-Klick auf eine Monatskacheln springen Sie direkt an den Anfang dessens</p>
</div> </div>
</div> </div>
<div className={"help-line"}> <div className={"help-line"}>
<img src={screen2.src}/> <img src={screen2.src} width={1000}/>
<div className={"text-form"}> <div className={"text-form"}>
<h1>Die Planungs-Ansicht</h1> <h1>Die Planungs-Ansicht</h1>
<p>- Hier siehst du alle deine Termine in grün (bzw. gelb bei Warnungen) und von anderen Dozenten in grau</p> <p>- Hier sehen Sie Ihre eingetragenen Vorlesungen in diesem Kurs in Grün, Ihre eigenen Vorlesungen aus anderen Kursen in Blau und die geplanten Vorlesungen anderer Dozenten in Grau</p>
<p>- Durch einen Links-Klick kannst du eine neue Vorlesung an einem Tag erstellen</p> <p>- Durch einen Links-Klick können Sie eine neue Vorlesung an einem Tag erstellen</p>
<p>- Durch Halten der dunkleren Leisten kannst du die Zeiten des Termins anpassen</p> <p>- Durch Halten der dunkleren Leisten ist es möglich die Zeiten Ihrer eigenen Termine anzupassen</p>
<p>- Durch Rechts-Klick kannst du eine Vorlesung löschen</p> <p>- Durch einen Rechts-Klick können eigene Termine gelöscht werden</p>
<p>- Durch Klicken auf die Pfeiltasten oben kannst du die Woche wechseln</p> <p>- Mithilfe der Navigationsleiste ist es möglich die Wochen zur Planung zu wechseln</p>
<p>- Bitte beachte, dass du Vorlesungen nur zwischen den beiden Roten linien erstellen kannst</p> <p>- Ausgegraute Tage liegen entweder nicht im Semester oder sind Feiertage, hier kann nicht geplant werden</p>
<p>- Ausgegraute Tage liegen nicht im Semester, hier kannst du nicht planen</p>
</div> </div>
</div> </div>
@@ -43,17 +42,8 @@ export default function Help(p)
<img src={screen3.src}/> <img src={screen3.src}/>
<div className={"text-form"}> <div className={"text-form"}>
<h1>Die Warnungs-Ansicht</h1> <h1>Die Warnungs-Ansicht</h1>
<p>- Sollte ein Termin gelb erscheinen kannst du hier sehen woran das liegt</p> <p>- Sollte ein Termin gelb erscheinen können Sie hier sehen woran das liegt</p>
<p>- Warnung sind empfohlene Verbesserungsverschläge aber müssen nicht zwangshaft beachtet werden</p> <p>- Warnung sind empfohlene Verbesserungsverschläge, müssen aber nicht zwangshaft beachtet werden</p>
<p>- Sollte hier "Okay" für einen Tag stehen ist alles perfekt</p>
</div>
</div>
<div className={"help-line"}>
<img src={screen5.src}/>
<div className={"text-form"}>
<h1>Der Login</h1>
<p>- Hier kannst du dich mit deiner Email und deinem Passwort einloggen</p>
</div> </div>
</div> </div>
@@ -69,15 +59,23 @@ export default function Help(p)
<div className={"help-line"}> <div className={"help-line"}>
<img src={screen6.src}/> <img src={screen6.src}/>
<div className={"text-form"}> <div className={"text-form"}>
<h1>Das Dashboard</h1> <h1>Das Dashboard für Admins</h1>
<h2>Für Admins:</h2> <p>- Hier werden alle bestehenden Semester gelistet</p>
<p>- Über den "+" Knopf kannst du ein neues Semester erstellen</p> <p>- Über den "+" Button ist es möglich ein neues Semester zu erstellen</p>
<p>- Über den Stift kannst du ein bestehendes Semester editieren</p> <p>- Über das Stift-Symbol kann ein bestehends Semester editiert werden</p>
<p>- Über den Mülleimer kannst du ein bestehndes Semester löschen</p> <p>- Über das Mülleimer-Symbol kann ein bestehndes Semester gelöscht werden</p>
<h2>Für Dozenten (und Admins):</h2> <p>- Die Fortschrittsanzeige bleibt auf der (1) bis ein Dozent seinen Plan abgegeben hat, sobald das geschieht wechselt sie auf die (2) und wenn alle Dozenten ihre Pläne abgegeben haben, springt die Anzeige auf die (3)</p>
<p>- Hier siehst du deine Semester mit den jeweiligen Modulen</p> </div>
<p>- Sollte ein Semester bei dir Ausgegraut sein, wurdest du für dieses schon gewählt aber noch nicht freigeschalten</p> </div>
<p>- Duch einen Links-Klick auf ein weises Semester kann in die Planungsübersicht gewechselt werden</p>
<div className={"help-line"}>
<img src={screen5.src}/>
<div className={"text-form"}>
<h2>Das Dashboard für Dozenten</h2>
<p>- Hier werden alle Semester angzeigt in welchem der eingeloggte Dozent Vorlesungen planen soll</p>
<p>- Sollte ein Semester ausgegraut sein, wurden Sie für dieses schon gewählt aber noch nicht freigeschalten</p>
<p>- Durch einen Links-Klick auf ein weißes Semester kann in die Planungsübersicht gewechselt werden</p>
<p>- Die Fortschrittsanzeige bleibt auf der (1) bis eine Vorlesung geplant wird, sobald das geschieht wechselt sie auf die (2) und wenn der Dozent seinen Plan abgibt, springt die Anzeige auf die (3)</p>
</div> </div>
</div> </div>
@@ -85,10 +83,12 @@ export default function Help(p)
<img src={screen7.src}/> <img src={screen7.src}/>
<div className={"text-form"}> <div className={"text-form"}>
<h1>Semester erstellen / bearbeiten</h1> <h1>Semester erstellen / bearbeiten</h1>
<p>- Hier kannst du alle daten wie Name, Start- und Endzeitpunkt eines Semesters eintragen</p> <p>- Hier müssen die folgenden Daten eingetragen werden: Kursname sowie Start- und Endzeitpunkt einer Vorlesungsphase</p>
<p>- Du kannst einen Dozenten "wählen" d.h. er soll in diesem Semester dozieren</p> <p>- Der Start muss vor dem Endzeitpunkt liegen</p>
<p>- Jedem Dozenten kannst du ein Modul zuordnen, welches er dozieren soll</p> <p>- Einen Dozenten zu wählen bedeutet ihn dem Kurs hinzuzufügen, sollte ihm kein Modul zugewiesen werden, wird er automatisch abgewählt</p>
<p>- Sobald du die Schaltfläche "Freischalten" aktiviert hast, kann der Dozent mit der eigenständigen Planung beginnen.</p> <p>- Ein Dozent muss mindestens ein, kann aber auch mehrere Module zugewiesen bekommen</p>
<p>- Um einem Dozenten mehrere Module zuzuweisen, halte die "STRG"-Taste gedrückt während du per Links klick die Module auswählst</p>
<p>- Sobald die Schaltfläche "Freischalten" aktiviert wurde, kann der Dozent mit der eigenständigen Planung beginnen</p>
<p>- Jeder genannte Schritt, insbesondere der Letzte kann auch nachträglich im Bearbeitungsmodus ausgeführt werden</p> <p>- Jeder genannte Schritt, insbesondere der Letzte kann auch nachträglich im Bearbeitungsmodus ausgeführt werden</p>
</div> </div>
</div> </div>
-1
View File
@@ -26,7 +26,6 @@ export default function Home(p) {
<div className={"normal-centered"}> <div className={"normal-centered"}>
<Background/> <Background/>
<HelpButton/>
<h1 style={{ <h1 style={{
fontSize: 40, fontSize: 40,
fontWeight: "bold", fontWeight: "bold",
+9
View File
@@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="h2-2.1.214">
<CLASSES>
<root url="jar://$PROJECT_DIR$/H2JDBCDriver/h2-2.1.214.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
Binary file not shown.
File diff suppressed because it is too large Load Diff
+15
View File
@@ -0,0 +1,15 @@
{
"name": "TIF22A_AnwProjekt_B",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/feiertagejs": {
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/feiertagejs/-/feiertagejs-1.3.9.tgz",
"integrity": "sha512-tUP+WBv2OWBhPwe3NfqwCtjMq+ym598a42tfqmL0FySswEb9xs96p2iKwqqx+lxKieu1njJBRZKsFm92bJhxZw==",
"engines": {
"node": ">=8.0.0"
}
}
}
}
+22
View File
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Simon Fakir
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+93
View File
@@ -0,0 +1,93 @@
# Feiertage.js
[![npm version](https://badge.fury.io/js/feiertagejs.svg)](https://badge.fury.io/js/feiertagejs)
[![Build Status](https://travis-ci.org/sfakir/feiertagejs.svg?branch=master)](https://travis-ci.org/sfakir/feiertagejs)
Feiertage.js is a small *typescript* npm module without dependencies to calculate German holidays for each Bundesland.
## Installation
- [yarn](https://yarnpkg.com/en/): `yarn add feiertagejs`
- [npm](https://www.npmjs.com/): `npm install feiertagejs`
- [bower](https://bower.io/): `bower install feiertagejs` *outdated!*
- [Plain Javascript](http://extern.fakir.it/feiertagejs/feiertagejs.zip) *outdated!*
## 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](docs.md).
```javascript
import { getHolidays, isHoliday, isSpecificHoliday } from 'feiertagejs';
const today = new Date();
console.log(isHoliday(today, 'BW'));
// probably false, because you are working ;)
// check if a day is a specific holiday:
console.log(isSpecificHoliday(today, 'CHRISTIHIMMELFAHRT','ALL'));
// 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');
console.log('date', holidays2023[0].date); // = Date("2023-01-01");
console.log('name', holidays2023[0].name); // 'NEUJAHRSTAG' (constant)
console.log('translation', holidays2023[0].trans('de')); // German translation: Neujahrstag
console.log('equals?', holidays2023[0].equals(date)); // Compare days only (ignore time)
```
### Usage in Node.js
```javascript
var feiertagejs = require('feiertagejs');
var today = new Date();
console.log(feiertagejs.isHoliday(today, 'BW'));
// probably false, because you are working ;)
// check if a day is a specific holiday:
console.log(feiertagejs.isSpecificHoliday(today, 'CHRISTIHIMMELFAHRT'));
// get all holiday for a single year: getHolidays()
// returns an array of "Holiday" Objects. Please see the docs.md for all properties.
var holidays2023 = feiertagejs.getHolidays('2023', 'BUND');
console.log('date', holidays2023[0].date); // = Date("2023-01-01");
console.log('name', holidays2023[0].name); // 'NEUJAHRSTAG' (constant)
console.log('translation', holidays2023[0].translate()); // German translation: Neujahrstag
console.log('equals?', holidays2023[0].equals(date)); // Compare days only (ignore time)
```
## API doc
The full API doc can be found [here](docs.md).
## Feedback and Questions
You have two options two give feedback or ask questions:
* Comment the official release [post](https://fakir.tech/de/feiertage-js-deutsche-feiertage-fuer-node-js-und-browser-javascript/)
* Open issues or pullrequests on [github](https://github.com/sfakir/feiertagejs)
## Contributors
Thank you for contributing:
* thetric
* SteveOswald
## Feedback
If you have any questions, feel free to open an issue.
+476
View File
@@ -0,0 +1,476 @@
const germanTranslations = {
NEUJAHRSTAG: 'Neujahrstag',
HEILIGEDREIKOENIGE: 'Heilige Drei Könige',
KARFREITAG: 'Karfreitag',
OSTERSONNTAG: 'Ostersonntag',
OSTERMONTAG: 'Ostermontag',
TAG_DER_ARBEIT: 'Tag der Arbeit',
CHRISTIHIMMELFAHRT: 'Christi Himmelfahrt',
PFINGSTSONNTAG: 'Pfingstsonntag',
PFINGSTMONTAG: 'Pfingstmontag',
FRONLEICHNAM: 'Fronleichnam',
MARIAHIMMELFAHRT: 'Mariä Himmelfahrt',
DEUTSCHEEINHEIT: 'Tag der Deutschen Einheit',
REFORMATIONSTAG: 'Reformationstag',
ALLERHEILIGEN: 'Allerheiligen',
BUBETAG: 'Buß- und Bettag',
ERSTERWEIHNACHTSFEIERTAG: '1. Weihnachtstag',
ZWEITERWEIHNACHTSFEIERTAG: '2. Weihnachtstag',
WELTKINDERTAG: 'Weltkindertag',
WELTFRAUENTAG: 'Weltfrauentag',
AUGSBURGER_FRIEDENSFEST: 'Augsburger Friedensfest',
};
const allHolidays = [
'NEUJAHRSTAG',
'HEILIGEDREIKOENIGE',
'KARFREITAG',
'OSTERSONNTAG',
'OSTERMONTAG',
'TAG_DER_ARBEIT',
'CHRISTIHIMMELFAHRT',
'MARIAHIMMELFAHRT',
'PFINGSTSONNTAG',
'PFINGSTMONTAG',
'FRONLEICHNAM',
'DEUTSCHEEINHEIT',
'REFORMATIONSTAG',
'ALLERHEILIGEN',
'BUBETAG',
'ERSTERWEIHNACHTSFEIERTAG',
'ZWEITERWEIHNACHTSFEIERTAG',
'WELTKINDERTAG',
'WELTFRAUENTAG',
'AUGSBURGER_FRIEDENSFEST',
];
const allRegions = [
'BW',
'BY',
'BE',
'BB',
'HB',
'HE',
'HH',
'MV',
'NI',
'NW',
'RP',
'SL',
'SN',
'ST',
'SH',
'TH',
'BUND',
'AUGSBURG',
'ALL',
];
/*!
* feiertage.js
* @repository https://github.com/sfakir/feiertagejs
* @docs https://github.com/sfakir/feiertagejs/blob/master/docs.md
*
* Copyright 2015-2021 Simon Fakir
* Released under the MIT license
*/
// translations
const defaultLanguage = 'de';
let currentLanguage = defaultLanguage;
const translations = {
de: germanTranslations,
};
/**
* adds a translation for the holidays (e.g. english).
* This also allows to override the German names.
* Hint: Interpolates German for missing translations
* @param {string} isoCode of the new language
* @param {TranslationTable} newTranslation map of {HolidayType} to translation stringg
*/
function addTranslation(isoCode, newTranslation) {
const code = isoCode.toLowerCase();
const defaultTranslation = translations[defaultLanguage];
let missingFields = false;
// fill new Translation with default Language
for (const holiday of allHolidays) {
if (!newTranslation[holiday]) {
missingFields = true;
newTranslation[holiday] = defaultTranslation[holiday];
}
}
if (missingFields) {
console.warn('[feiertagejs] addTranslation: you did not add all holidays in your translation! Took German as fallback');
}
translations[code] = newTranslation;
}
/**
* Set a language to default language
* @param {string} isoCode
*/
function setLanguage(isoCode) {
const code = isoCode.toLowerCase();
if (!translations[code]) {
throw new TypeError(`[feiertagejs] tried to set language to ${code} but the translation is missing. Please use addTranslation(isoCode,object) first`);
}
currentLanguage = isoCode;
}
/**
* Get currently set language
* @returns {string}
*/
function getLanguage() {
return currentLanguage;
}
// holidays api
/**
* Checks if a specific date is sunday or holiday.
* @param date
* @param region
* @returns {boolean}
*/
function isSunOrHoliday(date, region) {
checkRegion(region);
return date.getDay() === 0 || isHoliday(date, region);
}
/**
* Check is specific date is holiday.
* @param date
* @param {Region} region two character {@link Region} code
* @returns {boolean}
*/
function isHoliday(date, region) {
checkRegion(region);
const year = date.getFullYear();
const internalDate = toUtcTimestamp(date);
const holidays = getHolidaysAsUtcTimestamps(year, region);
return holidays.indexOf(internalDate) !== -1;
}
function getHolidayByDate(date, region = 'ALL') {
checkRegion(region);
const holidays = getHolidaysOfYear(date.getFullYear(), region);
return holidays.find((holiday) => holiday.equals(date));
}
// additional runtime checks
/**
* Checks if the given region is a valid {@link Region}.
*
* @param region {@link Region} to check
* @throws {Error}
* @private
*/
function checkRegion(region) {
if (region === null || region === undefined) {
throw new Error(`Region must not be undefined or null`);
}
if (allRegions.indexOf(region) === -1) {
throw new Error(`Invalid region: ${region}! Must be one of ${allRegions.toString()}`);
}
}
/**
* Checks if the given holidayName is a valid {@link HolidayType}.
* @param holidayName {@link HolidayType} to check
* @throws {Error}
* @private
*/
function checkHolidayType(holidayName) {
if (holidayName === null || holidayName === undefined) {
throw new TypeError('holidayName must not be null or undefined');
}
if (allHolidays.indexOf(holidayName) === -1) {
throw new Error(`feiertage.js: invalid holiday type "${holidayName}"! Must be one of ${allHolidays.toString()}`);
}
}
function isSpecificHoliday(date, holidayName, region = 'ALL') {
checkRegion(region);
checkHolidayType(holidayName);
const holidays = getHolidaysOfYear(date.getFullYear(), region);
const foundHoliday = holidays.find((holiday) => holiday.equals(date));
if (!foundHoliday) {
return false;
}
return foundHoliday.name === holidayName;
}
/**
* Returns all holidays of a year in a {@link Region}.
* @param year
* @param region
* @returns {Array.<Holiday>}
*/
function getHolidays(year, region) {
let y;
if (typeof year === 'string') {
y = parseInt(year, 10);
}
else {
y = year;
}
checkRegion(region);
return getHolidaysOfYear(y, region);
}
/**
*
* @param {number} year
* @param region
* @returns {number[]}
* @private
*/
function getHolidaysAsUtcTimestamps(year, region) {
const holidays = getHolidaysOfYear(year, region);
return holidays.map((holiday) => toUtcTimestamp(holiday.date));
}
/**
*
* @param {number} year
* @param region
* @returns {{objects: Array.<Holiday>, integers}}
* @private
*/
function getHolidaysOfYear(year, region) {
const easterDate = getEasterDate(year);
const karfreitag = addDays(new Date(easterDate.getTime()), -2);
const ostermontag = addDays(new Date(easterDate.getTime()), 1);
const christiHimmelfahrt = addDays(new Date(easterDate.getTime()), 39);
const pfingstsonntag = addDays(new Date(easterDate.getTime()), 49);
const pfingstmontag = addDays(new Date(easterDate.getTime()), 50);
const holidays = [
...getCommonHolidays(year),
newHoliday('KARFREITAG', karfreitag),
newHoliday('OSTERMONTAG', ostermontag),
newHoliday('CHRISTIHIMMELFAHRT', christiHimmelfahrt),
newHoliday('PFINGSTMONTAG', pfingstmontag),
];
addHeiligeDreiKoenige(year, region, holidays);
addEasterAndPfingsten(year, region, easterDate, pfingstsonntag, holidays);
addFronleichnam(region, easterDate, holidays);
addMariaeHimmelfahrt(year, region, holidays);
addReformationstag(year, region, holidays);
addAllerheiligen(year, region, holidays);
addBussUndBetttag(year, region, holidays);
addWeltkindertag(year, region, holidays);
addWeltfrauenTag(year, region, holidays);
addRegionalHolidays(year, region, holidays);
return holidays.sort((a, b) => a.date.getTime() - b.date.getTime());
}
function getCommonHolidays(year) {
return [
newHoliday('NEUJAHRSTAG', makeDate(year, 1, 1)),
newHoliday('TAG_DER_ARBEIT', makeDate(year, 5, 1)),
newHoliday('DEUTSCHEEINHEIT', makeDate(year, 10, 3)),
newHoliday('ERSTERWEIHNACHTSFEIERTAG', makeDate(year, 12, 25)),
newHoliday('ZWEITERWEIHNACHTSFEIERTAG', makeDate(year, 12, 26)),
];
}
function addRegionalHolidays(year, region, feiertageObjects) {
if (region === 'AUGSBURG') {
feiertageObjects.push(newHoliday('AUGSBURGER_FRIEDENSFEST', makeDate(year, 8, 8)));
}
}
function addHeiligeDreiKoenige(year, region, feiertageObjects) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'ST' ||
region === 'ALL') {
feiertageObjects.push(newHoliday('HEILIGEDREIKOENIGE', makeDate(year, 1, 6)));
}
}
function addEasterAndPfingsten(year, region, easterDate, pfingstsonntag, feiertageObjects) {
if (region === 'BB' || region === 'ALL') {
feiertageObjects.push(newHoliday('OSTERSONNTAG', easterDate), newHoliday('PFINGSTSONNTAG', pfingstsonntag));
}
}
function addFronleichnam(region, easterDate, holidays) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'HE' ||
region === 'NW' ||
region === 'RP' ||
region === 'SL' ||
region === 'ALL') {
const fronleichnam = addDays(new Date(easterDate.getTime()), 60);
holidays.push(newHoliday('FRONLEICHNAM', fronleichnam));
}
}
function addMariaeHimmelfahrt(year, region, holidays) {
if (region === 'SL' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'ALL') {
holidays.push(newHoliday('MARIAHIMMELFAHRT', makeDate(year, 8, 15)));
}
}
function addReformationstag(year, region, holidays) {
if (year === 2017 ||
region === 'NI' ||
region === 'BB' ||
region === 'HB' ||
region === 'HH' ||
region === 'MV' ||
region === 'SN' ||
region === 'ST' ||
region === 'TH' ||
region === 'SH' ||
region === 'ALL') {
holidays.push(newHoliday('REFORMATIONSTAG', makeDate(year, 10, 31)));
}
}
function addAllerheiligen(year, region, holidays) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'NW' ||
region === 'RP' ||
region === 'SL' ||
region === 'ALL') {
holidays.push(newHoliday('ALLERHEILIGEN', makeDate(year, 11, 1)));
}
}
function addBussUndBetttag(year, region, holidays) {
if (region === 'SN' || region === 'ALL') {
// @todo write test
const bussbettag = getBussBettag(year);
holidays.push(newHoliday('BUBETAG', makeDate(bussbettag.getUTCFullYear(), bussbettag.getUTCMonth() + 1, bussbettag.getUTCDate())));
}
}
function addWeltkindertag(year, region, holidays) {
if (year >= 2019 && (region === 'TH' || region === 'ALL')) {
holidays.push(newHoliday('WELTKINDERTAG', makeDate(year, 9, 20)));
}
}
function addWeltfrauenTag(year, region, feiertageObjects) {
if (year <= 2018) {
return;
}
if (region === 'BE' || region === 'ALL') {
// in Berlin ist der Weltfrauentag ein Feiertag seit 2018
feiertageObjects.push(newHoliday('WELTFRAUENTAG', makeDate(year, 3, 8)));
}
if (region === 'MV' && year >= 2023) {
// in MV wird der Weltfrauentag erst ab 2023 eingeführt
feiertageObjects.push(newHoliday('WELTFRAUENTAG', makeDate(year, 3, 8)));
}
}
/**
* Calculates the Easter date of a given year.
* @param year {number}
* @returns {Date} Easter date
* @private
*/
function getEasterDate(year) {
const C = Math.floor(year / 100);
// tslint:disable:binary-expression-operand-order
// tslint generates false positives in the following blocks
const N = year - 19 * Math.floor(year / 19);
const K = Math.floor((C - 17) / 25);
let I = C - Math.floor(C / 4) - Math.floor((C - K) / 3) + 19 * N + 15;
I -= 30 * Math.floor(I / 30);
I -=
Math.floor(I / 28) *
(1 -
Math.floor(I / 28) *
Math.floor(29 / (I + 1)) *
Math.floor((21 - N) / 11));
let J = year + Math.floor(year / 4) + I + 2 - C + Math.floor(C / 4);
J -= 7 * Math.floor(J / 7);
const L = I - J;
const M = 3 + Math.floor((L + 40) / 44);
const D = L + 28 - 31 * Math.floor(M / 4);
// tslint:enable:binary-expression-operand-order
return new Date(year, M - 1, D);
}
/**
* Computes the "Buss- und Bettag"'s date.
* @param jahr {number}
* @returns {Date} the year's "Buss- und Bettag" date
* @private
*/
function getBussBettag(jahr) {
const weihnachten = new Date(jahr, 11, 25, 12, 0, 0);
const ersterAdventOffset = 32;
let wochenTagOffset = weihnachten.getDay() % 7;
if (wochenTagOffset === 0) {
wochenTagOffset = 7;
}
const tageVorWeihnachten = wochenTagOffset + ersterAdventOffset;
let bbtag = new Date(weihnachten.getTime());
bbtag = addDays(bbtag, -tageVorWeihnachten);
return bbtag;
}
/**
* Adds {@code days} days to the given {@link Date}.
* @param date
* @param days
* @returns {Date}
* @private
*/
function addDays(date, days) {
const changedDate = new Date(date);
changedDate.setDate(date.getDate() + days);
return changedDate;
}
/**
* Creates a new {@link Date}.
* @param year
* @param naturalMonth month (1-12)
* @param day
* @returns {Date}
* @private
*/
function makeDate(year, naturalMonth, day) {
return new Date(year, naturalMonth - 1, day);
}
/**
*
* @param name
* @param date
* @returns {Holiday}
* @private
*/
function newHoliday(name, date) {
return {
name,
date,
dateString: localeDateObjectToDateString(date),
trans(lang = currentLanguage) {
console.warn('FeiertageJs: You are using "Holiday.trans() method. This will be replaced in the next major version with translate()"');
return this.translate(lang);
},
translate(lang = currentLanguage) {
return lang === undefined || lang === null
? undefined
: translations[lang][this.name];
},
getNormalizedDate() {
return toUtcTimestamp(this.date);
},
equals(otherDate) {
const dateString = localeDateObjectToDateString(otherDate);
return this.dateString === dateString;
},
};
}
/**
*
* @param date
* @returns {string}
* @private
*/
function localeDateObjectToDateString(date) {
const normalizedDate = new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000);
normalizedDate.setUTCHours(0, 0, 0, 0);
return normalizedDate.toISOString().slice(0, 10);
}
/**
* Returns the UTC timestamp of the given date with hours, minutes, seconds, and milliseconds set to zero.
* @param date
* @returns {number} UTC timestamp
*/
function toUtcTimestamp(date) {
const internalDate = new Date(date);
internalDate.setHours(0, 0, 0, 0);
return internalDate.getTime();
}
export { addTranslation, getHolidayByDate, getHolidays, getLanguage, isHoliday, isSpecificHoliday, isSunOrHoliday, setLanguage };
//# sourceMappingURL=feiertage.esm.js.map
File diff suppressed because one or more lines are too long
+476
View File
@@ -0,0 +1,476 @@
const germanTranslations = {
NEUJAHRSTAG: 'Neujahrstag',
HEILIGEDREIKOENIGE: 'Heilige Drei Könige',
KARFREITAG: 'Karfreitag',
OSTERSONNTAG: 'Ostersonntag',
OSTERMONTAG: 'Ostermontag',
TAG_DER_ARBEIT: 'Tag der Arbeit',
CHRISTIHIMMELFAHRT: 'Christi Himmelfahrt',
PFINGSTSONNTAG: 'Pfingstsonntag',
PFINGSTMONTAG: 'Pfingstmontag',
FRONLEICHNAM: 'Fronleichnam',
MARIAHIMMELFAHRT: 'Mariä Himmelfahrt',
DEUTSCHEEINHEIT: 'Tag der Deutschen Einheit',
REFORMATIONSTAG: 'Reformationstag',
ALLERHEILIGEN: 'Allerheiligen',
BUBETAG: 'Buß- und Bettag',
ERSTERWEIHNACHTSFEIERTAG: '1. Weihnachtstag',
ZWEITERWEIHNACHTSFEIERTAG: '2. Weihnachtstag',
WELTKINDERTAG: 'Weltkindertag',
WELTFRAUENTAG: 'Weltfrauentag',
AUGSBURGER_FRIEDENSFEST: 'Augsburger Friedensfest',
};
const allHolidays = [
'NEUJAHRSTAG',
'HEILIGEDREIKOENIGE',
'KARFREITAG',
'OSTERSONNTAG',
'OSTERMONTAG',
'TAG_DER_ARBEIT',
'CHRISTIHIMMELFAHRT',
'MARIAHIMMELFAHRT',
'PFINGSTSONNTAG',
'PFINGSTMONTAG',
'FRONLEICHNAM',
'DEUTSCHEEINHEIT',
'REFORMATIONSTAG',
'ALLERHEILIGEN',
'BUBETAG',
'ERSTERWEIHNACHTSFEIERTAG',
'ZWEITERWEIHNACHTSFEIERTAG',
'WELTKINDERTAG',
'WELTFRAUENTAG',
'AUGSBURGER_FRIEDENSFEST',
];
const allRegions = [
'BW',
'BY',
'BE',
'BB',
'HB',
'HE',
'HH',
'MV',
'NI',
'NW',
'RP',
'SL',
'SN',
'ST',
'SH',
'TH',
'BUND',
'AUGSBURG',
'ALL',
];
/*!
* feiertage.js
* @repository https://github.com/sfakir/feiertagejs
* @docs https://github.com/sfakir/feiertagejs/blob/master/docs.md
*
* Copyright 2015-2021 Simon Fakir
* Released under the MIT license
*/
// translations
const defaultLanguage = 'de';
let currentLanguage = defaultLanguage;
const translations = {
de: germanTranslations,
};
/**
* adds a translation for the holidays (e.g. english).
* This also allows to override the German names.
* Hint: Interpolates German for missing translations
* @param {string} isoCode of the new language
* @param {TranslationTable} newTranslation map of {HolidayType} to translation stringg
*/
function addTranslation(isoCode, newTranslation) {
const code = isoCode.toLowerCase();
const defaultTranslation = translations[defaultLanguage];
let missingFields = false;
// fill new Translation with default Language
for (const holiday of allHolidays) {
if (!newTranslation[holiday]) {
missingFields = true;
newTranslation[holiday] = defaultTranslation[holiday];
}
}
if (missingFields) {
console.warn('[feiertagejs] addTranslation: you did not add all holidays in your translation! Took German as fallback');
}
translations[code] = newTranslation;
}
/**
* Set a language to default language
* @param {string} isoCode
*/
function setLanguage(isoCode) {
const code = isoCode.toLowerCase();
if (!translations[code]) {
throw new TypeError(`[feiertagejs] tried to set language to ${code} but the translation is missing. Please use addTranslation(isoCode,object) first`);
}
currentLanguage = isoCode;
}
/**
* Get currently set language
* @returns {string}
*/
function getLanguage() {
return currentLanguage;
}
// holidays api
/**
* Checks if a specific date is sunday or holiday.
* @param date
* @param region
* @returns {boolean}
*/
function isSunOrHoliday(date, region) {
checkRegion(region);
return date.getDay() === 0 || isHoliday(date, region);
}
/**
* Check is specific date is holiday.
* @param date
* @param {Region} region two character {@link Region} code
* @returns {boolean}
*/
function isHoliday(date, region) {
checkRegion(region);
const year = date.getFullYear();
const internalDate = toUtcTimestamp(date);
const holidays = getHolidaysAsUtcTimestamps(year, region);
return holidays.indexOf(internalDate) !== -1;
}
function getHolidayByDate(date, region = 'ALL') {
checkRegion(region);
const holidays = getHolidaysOfYear(date.getFullYear(), region);
return holidays.find((holiday) => holiday.equals(date));
}
// additional runtime checks
/**
* Checks if the given region is a valid {@link Region}.
*
* @param region {@link Region} to check
* @throws {Error}
* @private
*/
function checkRegion(region) {
if (region === null || region === undefined) {
throw new Error(`Region must not be undefined or null`);
}
if (allRegions.indexOf(region) === -1) {
throw new Error(`Invalid region: ${region}! Must be one of ${allRegions.toString()}`);
}
}
/**
* Checks if the given holidayName is a valid {@link HolidayType}.
* @param holidayName {@link HolidayType} to check
* @throws {Error}
* @private
*/
function checkHolidayType(holidayName) {
if (holidayName === null || holidayName === undefined) {
throw new TypeError('holidayName must not be null or undefined');
}
if (allHolidays.indexOf(holidayName) === -1) {
throw new Error(`feiertage.js: invalid holiday type "${holidayName}"! Must be one of ${allHolidays.toString()}`);
}
}
function isSpecificHoliday(date, holidayName, region = 'ALL') {
checkRegion(region);
checkHolidayType(holidayName);
const holidays = getHolidaysOfYear(date.getFullYear(), region);
const foundHoliday = holidays.find((holiday) => holiday.equals(date));
if (!foundHoliday) {
return false;
}
return foundHoliday.name === holidayName;
}
/**
* Returns all holidays of a year in a {@link Region}.
* @param year
* @param region
* @returns {Array.<Holiday>}
*/
function getHolidays(year, region) {
let y;
if (typeof year === 'string') {
y = parseInt(year, 10);
}
else {
y = year;
}
checkRegion(region);
return getHolidaysOfYear(y, region);
}
/**
*
* @param {number} year
* @param region
* @returns {number[]}
* @private
*/
function getHolidaysAsUtcTimestamps(year, region) {
const holidays = getHolidaysOfYear(year, region);
return holidays.map((holiday) => toUtcTimestamp(holiday.date));
}
/**
*
* @param {number} year
* @param region
* @returns {{objects: Array.<Holiday>, integers}}
* @private
*/
function getHolidaysOfYear(year, region) {
const easterDate = getEasterDate(year);
const karfreitag = addDays(new Date(easterDate.getTime()), -2);
const ostermontag = addDays(new Date(easterDate.getTime()), 1);
const christiHimmelfahrt = addDays(new Date(easterDate.getTime()), 39);
const pfingstsonntag = addDays(new Date(easterDate.getTime()), 49);
const pfingstmontag = addDays(new Date(easterDate.getTime()), 50);
const holidays = [
...getCommonHolidays(year),
newHoliday('KARFREITAG', karfreitag),
newHoliday('OSTERMONTAG', ostermontag),
newHoliday('CHRISTIHIMMELFAHRT', christiHimmelfahrt),
newHoliday('PFINGSTMONTAG', pfingstmontag),
];
addHeiligeDreiKoenige(year, region, holidays);
addEasterAndPfingsten(year, region, easterDate, pfingstsonntag, holidays);
addFronleichnam(region, easterDate, holidays);
addMariaeHimmelfahrt(year, region, holidays);
addReformationstag(year, region, holidays);
addAllerheiligen(year, region, holidays);
addBussUndBetttag(year, region, holidays);
addWeltkindertag(year, region, holidays);
addWeltfrauenTag(year, region, holidays);
addRegionalHolidays(year, region, holidays);
return holidays.sort((a, b) => a.date.getTime() - b.date.getTime());
}
function getCommonHolidays(year) {
return [
newHoliday('NEUJAHRSTAG', makeDate(year, 1, 1)),
newHoliday('TAG_DER_ARBEIT', makeDate(year, 5, 1)),
newHoliday('DEUTSCHEEINHEIT', makeDate(year, 10, 3)),
newHoliday('ERSTERWEIHNACHTSFEIERTAG', makeDate(year, 12, 25)),
newHoliday('ZWEITERWEIHNACHTSFEIERTAG', makeDate(year, 12, 26)),
];
}
function addRegionalHolidays(year, region, feiertageObjects) {
if (region === 'AUGSBURG') {
feiertageObjects.push(newHoliday('AUGSBURGER_FRIEDENSFEST', makeDate(year, 8, 8)));
}
}
function addHeiligeDreiKoenige(year, region, feiertageObjects) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'ST' ||
region === 'ALL') {
feiertageObjects.push(newHoliday('HEILIGEDREIKOENIGE', makeDate(year, 1, 6)));
}
}
function addEasterAndPfingsten(year, region, easterDate, pfingstsonntag, feiertageObjects) {
if (region === 'BB' || region === 'ALL') {
feiertageObjects.push(newHoliday('OSTERSONNTAG', easterDate), newHoliday('PFINGSTSONNTAG', pfingstsonntag));
}
}
function addFronleichnam(region, easterDate, holidays) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'HE' ||
region === 'NW' ||
region === 'RP' ||
region === 'SL' ||
region === 'ALL') {
const fronleichnam = addDays(new Date(easterDate.getTime()), 60);
holidays.push(newHoliday('FRONLEICHNAM', fronleichnam));
}
}
function addMariaeHimmelfahrt(year, region, holidays) {
if (region === 'SL' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'ALL') {
holidays.push(newHoliday('MARIAHIMMELFAHRT', makeDate(year, 8, 15)));
}
}
function addReformationstag(year, region, holidays) {
if (year === 2017 ||
region === 'NI' ||
region === 'BB' ||
region === 'HB' ||
region === 'HH' ||
region === 'MV' ||
region === 'SN' ||
region === 'ST' ||
region === 'TH' ||
region === 'SH' ||
region === 'ALL') {
holidays.push(newHoliday('REFORMATIONSTAG', makeDate(year, 10, 31)));
}
}
function addAllerheiligen(year, region, holidays) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'NW' ||
region === 'RP' ||
region === 'SL' ||
region === 'ALL') {
holidays.push(newHoliday('ALLERHEILIGEN', makeDate(year, 11, 1)));
}
}
function addBussUndBetttag(year, region, holidays) {
if (region === 'SN' || region === 'ALL') {
// @todo write test
const bussbettag = getBussBettag(year);
holidays.push(newHoliday('BUBETAG', makeDate(bussbettag.getUTCFullYear(), bussbettag.getUTCMonth() + 1, bussbettag.getUTCDate())));
}
}
function addWeltkindertag(year, region, holidays) {
if (year >= 2019 && (region === 'TH' || region === 'ALL')) {
holidays.push(newHoliday('WELTKINDERTAG', makeDate(year, 9, 20)));
}
}
function addWeltfrauenTag(year, region, feiertageObjects) {
if (year <= 2018) {
return;
}
if (region === 'BE' || region === 'ALL') {
// in Berlin ist der Weltfrauentag ein Feiertag seit 2018
feiertageObjects.push(newHoliday('WELTFRAUENTAG', makeDate(year, 3, 8)));
}
if (region === 'MV' && year >= 2023) {
// in MV wird der Weltfrauentag erst ab 2023 eingeführt
feiertageObjects.push(newHoliday('WELTFRAUENTAG', makeDate(year, 3, 8)));
}
}
/**
* Calculates the Easter date of a given year.
* @param year {number}
* @returns {Date} Easter date
* @private
*/
function getEasterDate(year) {
const C = Math.floor(year / 100);
// tslint:disable:binary-expression-operand-order
// tslint generates false positives in the following blocks
const N = year - 19 * Math.floor(year / 19);
const K = Math.floor((C - 17) / 25);
let I = C - Math.floor(C / 4) - Math.floor((C - K) / 3) + 19 * N + 15;
I -= 30 * Math.floor(I / 30);
I -=
Math.floor(I / 28) *
(1 -
Math.floor(I / 28) *
Math.floor(29 / (I + 1)) *
Math.floor((21 - N) / 11));
let J = year + Math.floor(year / 4) + I + 2 - C + Math.floor(C / 4);
J -= 7 * Math.floor(J / 7);
const L = I - J;
const M = 3 + Math.floor((L + 40) / 44);
const D = L + 28 - 31 * Math.floor(M / 4);
// tslint:enable:binary-expression-operand-order
return new Date(year, M - 1, D);
}
/**
* Computes the "Buss- und Bettag"'s date.
* @param jahr {number}
* @returns {Date} the year's "Buss- und Bettag" date
* @private
*/
function getBussBettag(jahr) {
const weihnachten = new Date(jahr, 11, 25, 12, 0, 0);
const ersterAdventOffset = 32;
let wochenTagOffset = weihnachten.getDay() % 7;
if (wochenTagOffset === 0) {
wochenTagOffset = 7;
}
const tageVorWeihnachten = wochenTagOffset + ersterAdventOffset;
let bbtag = new Date(weihnachten.getTime());
bbtag = addDays(bbtag, -tageVorWeihnachten);
return bbtag;
}
/**
* Adds {@code days} days to the given {@link Date}.
* @param date
* @param days
* @returns {Date}
* @private
*/
function addDays(date, days) {
const changedDate = new Date(date);
changedDate.setDate(date.getDate() + days);
return changedDate;
}
/**
* Creates a new {@link Date}.
* @param year
* @param naturalMonth month (1-12)
* @param day
* @returns {Date}
* @private
*/
function makeDate(year, naturalMonth, day) {
return new Date(year, naturalMonth - 1, day);
}
/**
*
* @param name
* @param date
* @returns {Holiday}
* @private
*/
function newHoliday(name, date) {
return {
name,
date,
dateString: localeDateObjectToDateString(date),
trans(lang = currentLanguage) {
console.warn('FeiertageJs: You are using "Holiday.trans() method. This will be replaced in the next major version with translate()"');
return this.translate(lang);
},
translate(lang = currentLanguage) {
return lang === undefined || lang === null
? undefined
: translations[lang][this.name];
},
getNormalizedDate() {
return toUtcTimestamp(this.date);
},
equals(otherDate) {
const dateString = localeDateObjectToDateString(otherDate);
return this.dateString === dateString;
},
};
}
/**
*
* @param date
* @returns {string}
* @private
*/
function localeDateObjectToDateString(date) {
const normalizedDate = new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000);
normalizedDate.setUTCHours(0, 0, 0, 0);
return normalizedDate.toISOString().slice(0, 10);
}
/**
* Returns the UTC timestamp of the given date with hours, minutes, seconds, and milliseconds set to zero.
* @param date
* @returns {number} UTC timestamp
*/
function toUtcTimestamp(date) {
const internalDate = new Date(date);
internalDate.setHours(0, 0, 0, 0);
return internalDate.getTime();
}
export { addTranslation, getHolidayByDate, getHolidays, getLanguage, isHoliday, isSpecificHoliday, isSunOrHoliday, setLanguage };
//# sourceMappingURL=feiertage.js.map
File diff suppressed because one or more lines are too long
+496
View File
@@ -0,0 +1,496 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
var current = global.feiertagejs;
var exports = global.feiertagejs = {};
factory(exports);
exports.noConflict = function () { global.feiertagejs = current; return exports; };
})());
})(this, (function (exports) { 'use strict';
const germanTranslations = {
NEUJAHRSTAG: 'Neujahrstag',
HEILIGEDREIKOENIGE: 'Heilige Drei Könige',
KARFREITAG: 'Karfreitag',
OSTERSONNTAG: 'Ostersonntag',
OSTERMONTAG: 'Ostermontag',
TAG_DER_ARBEIT: 'Tag der Arbeit',
CHRISTIHIMMELFAHRT: 'Christi Himmelfahrt',
PFINGSTSONNTAG: 'Pfingstsonntag',
PFINGSTMONTAG: 'Pfingstmontag',
FRONLEICHNAM: 'Fronleichnam',
MARIAHIMMELFAHRT: 'Mariä Himmelfahrt',
DEUTSCHEEINHEIT: 'Tag der Deutschen Einheit',
REFORMATIONSTAG: 'Reformationstag',
ALLERHEILIGEN: 'Allerheiligen',
BUBETAG: 'Buß- und Bettag',
ERSTERWEIHNACHTSFEIERTAG: '1. Weihnachtstag',
ZWEITERWEIHNACHTSFEIERTAG: '2. Weihnachtstag',
WELTKINDERTAG: 'Weltkindertag',
WELTFRAUENTAG: 'Weltfrauentag',
AUGSBURGER_FRIEDENSFEST: 'Augsburger Friedensfest',
};
const allHolidays = [
'NEUJAHRSTAG',
'HEILIGEDREIKOENIGE',
'KARFREITAG',
'OSTERSONNTAG',
'OSTERMONTAG',
'TAG_DER_ARBEIT',
'CHRISTIHIMMELFAHRT',
'MARIAHIMMELFAHRT',
'PFINGSTSONNTAG',
'PFINGSTMONTAG',
'FRONLEICHNAM',
'DEUTSCHEEINHEIT',
'REFORMATIONSTAG',
'ALLERHEILIGEN',
'BUBETAG',
'ERSTERWEIHNACHTSFEIERTAG',
'ZWEITERWEIHNACHTSFEIERTAG',
'WELTKINDERTAG',
'WELTFRAUENTAG',
'AUGSBURGER_FRIEDENSFEST',
];
const allRegions = [
'BW',
'BY',
'BE',
'BB',
'HB',
'HE',
'HH',
'MV',
'NI',
'NW',
'RP',
'SL',
'SN',
'ST',
'SH',
'TH',
'BUND',
'AUGSBURG',
'ALL',
];
/*!
* feiertage.js
* @repository https://github.com/sfakir/feiertagejs
* @docs https://github.com/sfakir/feiertagejs/blob/master/docs.md
*
* Copyright 2015-2021 Simon Fakir
* Released under the MIT license
*/
// translations
const defaultLanguage = 'de';
let currentLanguage = defaultLanguage;
const translations = {
de: germanTranslations,
};
/**
* adds a translation for the holidays (e.g. english).
* This also allows to override the German names.
* Hint: Interpolates German for missing translations
* @param {string} isoCode of the new language
* @param {TranslationTable} newTranslation map of {HolidayType} to translation stringg
*/
function addTranslation(isoCode, newTranslation) {
const code = isoCode.toLowerCase();
const defaultTranslation = translations[defaultLanguage];
let missingFields = false;
// fill new Translation with default Language
for (const holiday of allHolidays) {
if (!newTranslation[holiday]) {
missingFields = true;
newTranslation[holiday] = defaultTranslation[holiday];
}
}
if (missingFields) {
console.warn('[feiertagejs] addTranslation: you did not add all holidays in your translation! Took German as fallback');
}
translations[code] = newTranslation;
}
/**
* Set a language to default language
* @param {string} isoCode
*/
function setLanguage(isoCode) {
const code = isoCode.toLowerCase();
if (!translations[code]) {
throw new TypeError(`[feiertagejs] tried to set language to ${code} but the translation is missing. Please use addTranslation(isoCode,object) first`);
}
currentLanguage = isoCode;
}
/**
* Get currently set language
* @returns {string}
*/
function getLanguage() {
return currentLanguage;
}
// holidays api
/**
* Checks if a specific date is sunday or holiday.
* @param date
* @param region
* @returns {boolean}
*/
function isSunOrHoliday(date, region) {
checkRegion(region);
return date.getDay() === 0 || isHoliday(date, region);
}
/**
* Check is specific date is holiday.
* @param date
* @param {Region} region two character {@link Region} code
* @returns {boolean}
*/
function isHoliday(date, region) {
checkRegion(region);
const year = date.getFullYear();
const internalDate = toUtcTimestamp(date);
const holidays = getHolidaysAsUtcTimestamps(year, region);
return holidays.indexOf(internalDate) !== -1;
}
function getHolidayByDate(date, region = 'ALL') {
checkRegion(region);
const holidays = getHolidaysOfYear(date.getFullYear(), region);
return holidays.find((holiday) => holiday.equals(date));
}
// additional runtime checks
/**
* Checks if the given region is a valid {@link Region}.
*
* @param region {@link Region} to check
* @throws {Error}
* @private
*/
function checkRegion(region) {
if (region === null || region === undefined) {
throw new Error(`Region must not be undefined or null`);
}
if (allRegions.indexOf(region) === -1) {
throw new Error(`Invalid region: ${region}! Must be one of ${allRegions.toString()}`);
}
}
/**
* Checks if the given holidayName is a valid {@link HolidayType}.
* @param holidayName {@link HolidayType} to check
* @throws {Error}
* @private
*/
function checkHolidayType(holidayName) {
if (holidayName === null || holidayName === undefined) {
throw new TypeError('holidayName must not be null or undefined');
}
if (allHolidays.indexOf(holidayName) === -1) {
throw new Error(`feiertage.js: invalid holiday type "${holidayName}"! Must be one of ${allHolidays.toString()}`);
}
}
function isSpecificHoliday(date, holidayName, region = 'ALL') {
checkRegion(region);
checkHolidayType(holidayName);
const holidays = getHolidaysOfYear(date.getFullYear(), region);
const foundHoliday = holidays.find((holiday) => holiday.equals(date));
if (!foundHoliday) {
return false;
}
return foundHoliday.name === holidayName;
}
/**
* Returns all holidays of a year in a {@link Region}.
* @param year
* @param region
* @returns {Array.<Holiday>}
*/
function getHolidays(year, region) {
let y;
if (typeof year === 'string') {
y = parseInt(year, 10);
}
else {
y = year;
}
checkRegion(region);
return getHolidaysOfYear(y, region);
}
/**
*
* @param {number} year
* @param region
* @returns {number[]}
* @private
*/
function getHolidaysAsUtcTimestamps(year, region) {
const holidays = getHolidaysOfYear(year, region);
return holidays.map((holiday) => toUtcTimestamp(holiday.date));
}
/**
*
* @param {number} year
* @param region
* @returns {{objects: Array.<Holiday>, integers}}
* @private
*/
function getHolidaysOfYear(year, region) {
const easterDate = getEasterDate(year);
const karfreitag = addDays(new Date(easterDate.getTime()), -2);
const ostermontag = addDays(new Date(easterDate.getTime()), 1);
const christiHimmelfahrt = addDays(new Date(easterDate.getTime()), 39);
const pfingstsonntag = addDays(new Date(easterDate.getTime()), 49);
const pfingstmontag = addDays(new Date(easterDate.getTime()), 50);
const holidays = [
...getCommonHolidays(year),
newHoliday('KARFREITAG', karfreitag),
newHoliday('OSTERMONTAG', ostermontag),
newHoliday('CHRISTIHIMMELFAHRT', christiHimmelfahrt),
newHoliday('PFINGSTMONTAG', pfingstmontag),
];
addHeiligeDreiKoenige(year, region, holidays);
addEasterAndPfingsten(year, region, easterDate, pfingstsonntag, holidays);
addFronleichnam(region, easterDate, holidays);
addMariaeHimmelfahrt(year, region, holidays);
addReformationstag(year, region, holidays);
addAllerheiligen(year, region, holidays);
addBussUndBetttag(year, region, holidays);
addWeltkindertag(year, region, holidays);
addWeltfrauenTag(year, region, holidays);
addRegionalHolidays(year, region, holidays);
return holidays.sort((a, b) => a.date.getTime() - b.date.getTime());
}
function getCommonHolidays(year) {
return [
newHoliday('NEUJAHRSTAG', makeDate(year, 1, 1)),
newHoliday('TAG_DER_ARBEIT', makeDate(year, 5, 1)),
newHoliday('DEUTSCHEEINHEIT', makeDate(year, 10, 3)),
newHoliday('ERSTERWEIHNACHTSFEIERTAG', makeDate(year, 12, 25)),
newHoliday('ZWEITERWEIHNACHTSFEIERTAG', makeDate(year, 12, 26)),
];
}
function addRegionalHolidays(year, region, feiertageObjects) {
if (region === 'AUGSBURG') {
feiertageObjects.push(newHoliday('AUGSBURGER_FRIEDENSFEST', makeDate(year, 8, 8)));
}
}
function addHeiligeDreiKoenige(year, region, feiertageObjects) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'ST' ||
region === 'ALL') {
feiertageObjects.push(newHoliday('HEILIGEDREIKOENIGE', makeDate(year, 1, 6)));
}
}
function addEasterAndPfingsten(year, region, easterDate, pfingstsonntag, feiertageObjects) {
if (region === 'BB' || region === 'ALL') {
feiertageObjects.push(newHoliday('OSTERSONNTAG', easterDate), newHoliday('PFINGSTSONNTAG', pfingstsonntag));
}
}
function addFronleichnam(region, easterDate, holidays) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'HE' ||
region === 'NW' ||
region === 'RP' ||
region === 'SL' ||
region === 'ALL') {
const fronleichnam = addDays(new Date(easterDate.getTime()), 60);
holidays.push(newHoliday('FRONLEICHNAM', fronleichnam));
}
}
function addMariaeHimmelfahrt(year, region, holidays) {
if (region === 'SL' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'ALL') {
holidays.push(newHoliday('MARIAHIMMELFAHRT', makeDate(year, 8, 15)));
}
}
function addReformationstag(year, region, holidays) {
if (year === 2017 ||
region === 'NI' ||
region === 'BB' ||
region === 'HB' ||
region === 'HH' ||
region === 'MV' ||
region === 'SN' ||
region === 'ST' ||
region === 'TH' ||
region === 'SH' ||
region === 'ALL') {
holidays.push(newHoliday('REFORMATIONSTAG', makeDate(year, 10, 31)));
}
}
function addAllerheiligen(year, region, holidays) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'NW' ||
region === 'RP' ||
region === 'SL' ||
region === 'ALL') {
holidays.push(newHoliday('ALLERHEILIGEN', makeDate(year, 11, 1)));
}
}
function addBussUndBetttag(year, region, holidays) {
if (region === 'SN' || region === 'ALL') {
// @todo write test
const bussbettag = getBussBettag(year);
holidays.push(newHoliday('BUBETAG', makeDate(bussbettag.getUTCFullYear(), bussbettag.getUTCMonth() + 1, bussbettag.getUTCDate())));
}
}
function addWeltkindertag(year, region, holidays) {
if (year >= 2019 && (region === 'TH' || region === 'ALL')) {
holidays.push(newHoliday('WELTKINDERTAG', makeDate(year, 9, 20)));
}
}
function addWeltfrauenTag(year, region, feiertageObjects) {
if (year <= 2018) {
return;
}
if (region === 'BE' || region === 'ALL') {
// in Berlin ist der Weltfrauentag ein Feiertag seit 2018
feiertageObjects.push(newHoliday('WELTFRAUENTAG', makeDate(year, 3, 8)));
}
if (region === 'MV' && year >= 2023) {
// in MV wird der Weltfrauentag erst ab 2023 eingeführt
feiertageObjects.push(newHoliday('WELTFRAUENTAG', makeDate(year, 3, 8)));
}
}
/**
* Calculates the Easter date of a given year.
* @param year {number}
* @returns {Date} Easter date
* @private
*/
function getEasterDate(year) {
const C = Math.floor(year / 100);
// tslint:disable:binary-expression-operand-order
// tslint generates false positives in the following blocks
const N = year - 19 * Math.floor(year / 19);
const K = Math.floor((C - 17) / 25);
let I = C - Math.floor(C / 4) - Math.floor((C - K) / 3) + 19 * N + 15;
I -= 30 * Math.floor(I / 30);
I -=
Math.floor(I / 28) *
(1 -
Math.floor(I / 28) *
Math.floor(29 / (I + 1)) *
Math.floor((21 - N) / 11));
let J = year + Math.floor(year / 4) + I + 2 - C + Math.floor(C / 4);
J -= 7 * Math.floor(J / 7);
const L = I - J;
const M = 3 + Math.floor((L + 40) / 44);
const D = L + 28 - 31 * Math.floor(M / 4);
// tslint:enable:binary-expression-operand-order
return new Date(year, M - 1, D);
}
/**
* Computes the "Buss- und Bettag"'s date.
* @param jahr {number}
* @returns {Date} the year's "Buss- und Bettag" date
* @private
*/
function getBussBettag(jahr) {
const weihnachten = new Date(jahr, 11, 25, 12, 0, 0);
const ersterAdventOffset = 32;
let wochenTagOffset = weihnachten.getDay() % 7;
if (wochenTagOffset === 0) {
wochenTagOffset = 7;
}
const tageVorWeihnachten = wochenTagOffset + ersterAdventOffset;
let bbtag = new Date(weihnachten.getTime());
bbtag = addDays(bbtag, -tageVorWeihnachten);
return bbtag;
}
/**
* Adds {@code days} days to the given {@link Date}.
* @param date
* @param days
* @returns {Date}
* @private
*/
function addDays(date, days) {
const changedDate = new Date(date);
changedDate.setDate(date.getDate() + days);
return changedDate;
}
/**
* Creates a new {@link Date}.
* @param year
* @param naturalMonth month (1-12)
* @param day
* @returns {Date}
* @private
*/
function makeDate(year, naturalMonth, day) {
return new Date(year, naturalMonth - 1, day);
}
/**
*
* @param name
* @param date
* @returns {Holiday}
* @private
*/
function newHoliday(name, date) {
return {
name,
date,
dateString: localeDateObjectToDateString(date),
trans(lang = currentLanguage) {
console.warn('FeiertageJs: You are using "Holiday.trans() method. This will be replaced in the next major version with translate()"');
return this.translate(lang);
},
translate(lang = currentLanguage) {
return lang === undefined || lang === null
? undefined
: translations[lang][this.name];
},
getNormalizedDate() {
return toUtcTimestamp(this.date);
},
equals(otherDate) {
const dateString = localeDateObjectToDateString(otherDate);
return this.dateString === dateString;
},
};
}
/**
*
* @param date
* @returns {string}
* @private
*/
function localeDateObjectToDateString(date) {
const normalizedDate = new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000);
normalizedDate.setUTCHours(0, 0, 0, 0);
return normalizedDate.toISOString().slice(0, 10);
}
/**
* Returns the UTC timestamp of the given date with hours, minutes, seconds, and milliseconds set to zero.
* @param date
* @returns {number} UTC timestamp
*/
function toUtcTimestamp(date) {
const internalDate = new Date(date);
internalDate.setHours(0, 0, 0, 0);
return internalDate.getTime();
}
exports.addTranslation = addTranslation;
exports.getHolidayByDate = getHolidayByDate;
exports.getHolidays = getHolidays;
exports.getLanguage = getLanguage;
exports.isHoliday = isHoliday;
exports.isSpecificHoliday = isSpecificHoliday;
exports.isSunOrHoliday = isSunOrHoliday;
exports.setLanguage = setLanguage;
}));
//# sourceMappingURL=feiertage.umd.cjs.map
File diff suppressed because one or more lines are too long
+496
View File
@@ -0,0 +1,496 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
var current = global.feiertagejs;
var exports = global.feiertagejs = {};
factory(exports);
exports.noConflict = function () { global.feiertagejs = current; return exports; };
})());
})(this, (function (exports) { 'use strict';
const germanTranslations = {
NEUJAHRSTAG: 'Neujahrstag',
HEILIGEDREIKOENIGE: 'Heilige Drei Könige',
KARFREITAG: 'Karfreitag',
OSTERSONNTAG: 'Ostersonntag',
OSTERMONTAG: 'Ostermontag',
TAG_DER_ARBEIT: 'Tag der Arbeit',
CHRISTIHIMMELFAHRT: 'Christi Himmelfahrt',
PFINGSTSONNTAG: 'Pfingstsonntag',
PFINGSTMONTAG: 'Pfingstmontag',
FRONLEICHNAM: 'Fronleichnam',
MARIAHIMMELFAHRT: 'Mariä Himmelfahrt',
DEUTSCHEEINHEIT: 'Tag der Deutschen Einheit',
REFORMATIONSTAG: 'Reformationstag',
ALLERHEILIGEN: 'Allerheiligen',
BUBETAG: 'Buß- und Bettag',
ERSTERWEIHNACHTSFEIERTAG: '1. Weihnachtstag',
ZWEITERWEIHNACHTSFEIERTAG: '2. Weihnachtstag',
WELTKINDERTAG: 'Weltkindertag',
WELTFRAUENTAG: 'Weltfrauentag',
AUGSBURGER_FRIEDENSFEST: 'Augsburger Friedensfest',
};
const allHolidays = [
'NEUJAHRSTAG',
'HEILIGEDREIKOENIGE',
'KARFREITAG',
'OSTERSONNTAG',
'OSTERMONTAG',
'TAG_DER_ARBEIT',
'CHRISTIHIMMELFAHRT',
'MARIAHIMMELFAHRT',
'PFINGSTSONNTAG',
'PFINGSTMONTAG',
'FRONLEICHNAM',
'DEUTSCHEEINHEIT',
'REFORMATIONSTAG',
'ALLERHEILIGEN',
'BUBETAG',
'ERSTERWEIHNACHTSFEIERTAG',
'ZWEITERWEIHNACHTSFEIERTAG',
'WELTKINDERTAG',
'WELTFRAUENTAG',
'AUGSBURGER_FRIEDENSFEST',
];
const allRegions = [
'BW',
'BY',
'BE',
'BB',
'HB',
'HE',
'HH',
'MV',
'NI',
'NW',
'RP',
'SL',
'SN',
'ST',
'SH',
'TH',
'BUND',
'AUGSBURG',
'ALL',
];
/*!
* feiertage.js
* @repository https://github.com/sfakir/feiertagejs
* @docs https://github.com/sfakir/feiertagejs/blob/master/docs.md
*
* Copyright 2015-2021 Simon Fakir
* Released under the MIT license
*/
// translations
const defaultLanguage = 'de';
let currentLanguage = defaultLanguage;
const translations = {
de: germanTranslations,
};
/**
* adds a translation for the holidays (e.g. english).
* This also allows to override the German names.
* Hint: Interpolates German for missing translations
* @param {string} isoCode of the new language
* @param {TranslationTable} newTranslation map of {HolidayType} to translation stringg
*/
function addTranslation(isoCode, newTranslation) {
const code = isoCode.toLowerCase();
const defaultTranslation = translations[defaultLanguage];
let missingFields = false;
// fill new Translation with default Language
for (const holiday of allHolidays) {
if (!newTranslation[holiday]) {
missingFields = true;
newTranslation[holiday] = defaultTranslation[holiday];
}
}
if (missingFields) {
console.warn('[feiertagejs] addTranslation: you did not add all holidays in your translation! Took German as fallback');
}
translations[code] = newTranslation;
}
/**
* Set a language to default language
* @param {string} isoCode
*/
function setLanguage(isoCode) {
const code = isoCode.toLowerCase();
if (!translations[code]) {
throw new TypeError(`[feiertagejs] tried to set language to ${code} but the translation is missing. Please use addTranslation(isoCode,object) first`);
}
currentLanguage = isoCode;
}
/**
* Get currently set language
* @returns {string}
*/
function getLanguage() {
return currentLanguage;
}
// holidays api
/**
* Checks if a specific date is sunday or holiday.
* @param date
* @param region
* @returns {boolean}
*/
function isSunOrHoliday(date, region) {
checkRegion(region);
return date.getDay() === 0 || isHoliday(date, region);
}
/**
* Check is specific date is holiday.
* @param date
* @param {Region} region two character {@link Region} code
* @returns {boolean}
*/
function isHoliday(date, region) {
checkRegion(region);
const year = date.getFullYear();
const internalDate = toUtcTimestamp(date);
const holidays = getHolidaysAsUtcTimestamps(year, region);
return holidays.indexOf(internalDate) !== -1;
}
function getHolidayByDate(date, region = 'ALL') {
checkRegion(region);
const holidays = getHolidaysOfYear(date.getFullYear(), region);
return holidays.find((holiday) => holiday.equals(date));
}
// additional runtime checks
/**
* Checks if the given region is a valid {@link Region}.
*
* @param region {@link Region} to check
* @throws {Error}
* @private
*/
function checkRegion(region) {
if (region === null || region === undefined) {
throw new Error(`Region must not be undefined or null`);
}
if (allRegions.indexOf(region) === -1) {
throw new Error(`Invalid region: ${region}! Must be one of ${allRegions.toString()}`);
}
}
/**
* Checks if the given holidayName is a valid {@link HolidayType}.
* @param holidayName {@link HolidayType} to check
* @throws {Error}
* @private
*/
function checkHolidayType(holidayName) {
if (holidayName === null || holidayName === undefined) {
throw new TypeError('holidayName must not be null or undefined');
}
if (allHolidays.indexOf(holidayName) === -1) {
throw new Error(`feiertage.js: invalid holiday type "${holidayName}"! Must be one of ${allHolidays.toString()}`);
}
}
function isSpecificHoliday(date, holidayName, region = 'ALL') {
checkRegion(region);
checkHolidayType(holidayName);
const holidays = getHolidaysOfYear(date.getFullYear(), region);
const foundHoliday = holidays.find((holiday) => holiday.equals(date));
if (!foundHoliday) {
return false;
}
return foundHoliday.name === holidayName;
}
/**
* Returns all holidays of a year in a {@link Region}.
* @param year
* @param region
* @returns {Array.<Holiday>}
*/
function getHolidays(year, region) {
let y;
if (typeof year === 'string') {
y = parseInt(year, 10);
}
else {
y = year;
}
checkRegion(region);
return getHolidaysOfYear(y, region);
}
/**
*
* @param {number} year
* @param region
* @returns {number[]}
* @private
*/
function getHolidaysAsUtcTimestamps(year, region) {
const holidays = getHolidaysOfYear(year, region);
return holidays.map((holiday) => toUtcTimestamp(holiday.date));
}
/**
*
* @param {number} year
* @param region
* @returns {{objects: Array.<Holiday>, integers}}
* @private
*/
function getHolidaysOfYear(year, region) {
const easterDate = getEasterDate(year);
const karfreitag = addDays(new Date(easterDate.getTime()), -2);
const ostermontag = addDays(new Date(easterDate.getTime()), 1);
const christiHimmelfahrt = addDays(new Date(easterDate.getTime()), 39);
const pfingstsonntag = addDays(new Date(easterDate.getTime()), 49);
const pfingstmontag = addDays(new Date(easterDate.getTime()), 50);
const holidays = [
...getCommonHolidays(year),
newHoliday('KARFREITAG', karfreitag),
newHoliday('OSTERMONTAG', ostermontag),
newHoliday('CHRISTIHIMMELFAHRT', christiHimmelfahrt),
newHoliday('PFINGSTMONTAG', pfingstmontag),
];
addHeiligeDreiKoenige(year, region, holidays);
addEasterAndPfingsten(year, region, easterDate, pfingstsonntag, holidays);
addFronleichnam(region, easterDate, holidays);
addMariaeHimmelfahrt(year, region, holidays);
addReformationstag(year, region, holidays);
addAllerheiligen(year, region, holidays);
addBussUndBetttag(year, region, holidays);
addWeltkindertag(year, region, holidays);
addWeltfrauenTag(year, region, holidays);
addRegionalHolidays(year, region, holidays);
return holidays.sort((a, b) => a.date.getTime() - b.date.getTime());
}
function getCommonHolidays(year) {
return [
newHoliday('NEUJAHRSTAG', makeDate(year, 1, 1)),
newHoliday('TAG_DER_ARBEIT', makeDate(year, 5, 1)),
newHoliday('DEUTSCHEEINHEIT', makeDate(year, 10, 3)),
newHoliday('ERSTERWEIHNACHTSFEIERTAG', makeDate(year, 12, 25)),
newHoliday('ZWEITERWEIHNACHTSFEIERTAG', makeDate(year, 12, 26)),
];
}
function addRegionalHolidays(year, region, feiertageObjects) {
if (region === 'AUGSBURG') {
feiertageObjects.push(newHoliday('AUGSBURGER_FRIEDENSFEST', makeDate(year, 8, 8)));
}
}
function addHeiligeDreiKoenige(year, region, feiertageObjects) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'ST' ||
region === 'ALL') {
feiertageObjects.push(newHoliday('HEILIGEDREIKOENIGE', makeDate(year, 1, 6)));
}
}
function addEasterAndPfingsten(year, region, easterDate, pfingstsonntag, feiertageObjects) {
if (region === 'BB' || region === 'ALL') {
feiertageObjects.push(newHoliday('OSTERSONNTAG', easterDate), newHoliday('PFINGSTSONNTAG', pfingstsonntag));
}
}
function addFronleichnam(region, easterDate, holidays) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'HE' ||
region === 'NW' ||
region === 'RP' ||
region === 'SL' ||
region === 'ALL') {
const fronleichnam = addDays(new Date(easterDate.getTime()), 60);
holidays.push(newHoliday('FRONLEICHNAM', fronleichnam));
}
}
function addMariaeHimmelfahrt(year, region, holidays) {
if (region === 'SL' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'ALL') {
holidays.push(newHoliday('MARIAHIMMELFAHRT', makeDate(year, 8, 15)));
}
}
function addReformationstag(year, region, holidays) {
if (year === 2017 ||
region === 'NI' ||
region === 'BB' ||
region === 'HB' ||
region === 'HH' ||
region === 'MV' ||
region === 'SN' ||
region === 'ST' ||
region === 'TH' ||
region === 'SH' ||
region === 'ALL') {
holidays.push(newHoliday('REFORMATIONSTAG', makeDate(year, 10, 31)));
}
}
function addAllerheiligen(year, region, holidays) {
if (region === 'BW' ||
region === 'BY' ||
region === 'AUGSBURG' ||
region === 'NW' ||
region === 'RP' ||
region === 'SL' ||
region === 'ALL') {
holidays.push(newHoliday('ALLERHEILIGEN', makeDate(year, 11, 1)));
}
}
function addBussUndBetttag(year, region, holidays) {
if (region === 'SN' || region === 'ALL') {
// @todo write test
const bussbettag = getBussBettag(year);
holidays.push(newHoliday('BUBETAG', makeDate(bussbettag.getUTCFullYear(), bussbettag.getUTCMonth() + 1, bussbettag.getUTCDate())));
}
}
function addWeltkindertag(year, region, holidays) {
if (year >= 2019 && (region === 'TH' || region === 'ALL')) {
holidays.push(newHoliday('WELTKINDERTAG', makeDate(year, 9, 20)));
}
}
function addWeltfrauenTag(year, region, feiertageObjects) {
if (year <= 2018) {
return;
}
if (region === 'BE' || region === 'ALL') {
// in Berlin ist der Weltfrauentag ein Feiertag seit 2018
feiertageObjects.push(newHoliday('WELTFRAUENTAG', makeDate(year, 3, 8)));
}
if (region === 'MV' && year >= 2023) {
// in MV wird der Weltfrauentag erst ab 2023 eingeführt
feiertageObjects.push(newHoliday('WELTFRAUENTAG', makeDate(year, 3, 8)));
}
}
/**
* Calculates the Easter date of a given year.
* @param year {number}
* @returns {Date} Easter date
* @private
*/
function getEasterDate(year) {
const C = Math.floor(year / 100);
// tslint:disable:binary-expression-operand-order
// tslint generates false positives in the following blocks
const N = year - 19 * Math.floor(year / 19);
const K = Math.floor((C - 17) / 25);
let I = C - Math.floor(C / 4) - Math.floor((C - K) / 3) + 19 * N + 15;
I -= 30 * Math.floor(I / 30);
I -=
Math.floor(I / 28) *
(1 -
Math.floor(I / 28) *
Math.floor(29 / (I + 1)) *
Math.floor((21 - N) / 11));
let J = year + Math.floor(year / 4) + I + 2 - C + Math.floor(C / 4);
J -= 7 * Math.floor(J / 7);
const L = I - J;
const M = 3 + Math.floor((L + 40) / 44);
const D = L + 28 - 31 * Math.floor(M / 4);
// tslint:enable:binary-expression-operand-order
return new Date(year, M - 1, D);
}
/**
* Computes the "Buss- und Bettag"'s date.
* @param jahr {number}
* @returns {Date} the year's "Buss- und Bettag" date
* @private
*/
function getBussBettag(jahr) {
const weihnachten = new Date(jahr, 11, 25, 12, 0, 0);
const ersterAdventOffset = 32;
let wochenTagOffset = weihnachten.getDay() % 7;
if (wochenTagOffset === 0) {
wochenTagOffset = 7;
}
const tageVorWeihnachten = wochenTagOffset + ersterAdventOffset;
let bbtag = new Date(weihnachten.getTime());
bbtag = addDays(bbtag, -tageVorWeihnachten);
return bbtag;
}
/**
* Adds {@code days} days to the given {@link Date}.
* @param date
* @param days
* @returns {Date}
* @private
*/
function addDays(date, days) {
const changedDate = new Date(date);
changedDate.setDate(date.getDate() + days);
return changedDate;
}
/**
* Creates a new {@link Date}.
* @param year
* @param naturalMonth month (1-12)
* @param day
* @returns {Date}
* @private
*/
function makeDate(year, naturalMonth, day) {
return new Date(year, naturalMonth - 1, day);
}
/**
*
* @param name
* @param date
* @returns {Holiday}
* @private
*/
function newHoliday(name, date) {
return {
name,
date,
dateString: localeDateObjectToDateString(date),
trans(lang = currentLanguage) {
console.warn('FeiertageJs: You are using "Holiday.trans() method. This will be replaced in the next major version with translate()"');
return this.translate(lang);
},
translate(lang = currentLanguage) {
return lang === undefined || lang === null
? undefined
: translations[lang][this.name];
},
getNormalizedDate() {
return toUtcTimestamp(this.date);
},
equals(otherDate) {
const dateString = localeDateObjectToDateString(otherDate);
return this.dateString === dateString;
},
};
}
/**
*
* @param date
* @returns {string}
* @private
*/
function localeDateObjectToDateString(date) {
const normalizedDate = new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000);
normalizedDate.setUTCHours(0, 0, 0, 0);
return normalizedDate.toISOString().slice(0, 10);
}
/**
* Returns the UTC timestamp of the given date with hours, minutes, seconds, and milliseconds set to zero.
* @param date
* @returns {number} UTC timestamp
*/
function toUtcTimestamp(date) {
const internalDate = new Date(date);
internalDate.setHours(0, 0, 0, 0);
return internalDate.getTime();
}
exports.addTranslation = addTranslation;
exports.getHolidayByDate = getHolidayByDate;
exports.getHolidays = getHolidays;
exports.getLanguage = getLanguage;
exports.isHoliday = isHoliday;
exports.isSpecificHoliday = isSpecificHoliday;
exports.isSunOrHoliday = isSunOrHoliday;
exports.setLanguage = setLanguage;
}));
//# sourceMappingURL=feiertage.umd.js.map
File diff suppressed because one or more lines are too long
+144
View File
@@ -0,0 +1,144 @@
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
### Table of Contents
*Types*
- [HolidayType](#holidaytype)
- [Region](#region)
- [Holiday](#holiday)
- [allHolidays](#allholidays)
- [allRegions](#allregions)
- [TranslationTable](#translationtable)
*API*
- [isHoliday(date, region)](#isholiday)
- [getHolidayByDate(date, region)](#getholidaybydate)
- [getHolidays(year, region)](#getholidays)
- [isSunOrHoliday(date, region)](#issunorholiday)
- [isSpecificHoliday(date, name, region)](#isspecificholiday)
- [addTranslation(isoCode, translation)](#addtranslation)
- [setLanguage(lng)](#setlanguage)
- [getLanguage()](#getlanguage)
## Types
### HolidayType
Type: (`"NEUJAHRSTAG"` \| `"HEILIGEDREIKOENIGE"` \| `"KARFREITAG"` \| `"OSTERSONNTAG"` \| `"OSTERMONTAG"` \| `"TAG_DER_ARBEIT"` \| `"CHRISTIHIMMELFAHRT"` \| `"MARIAHIMMELFAHRT"` \| `"PFINGSTSONNTAG"` \| `"PFINGSTMONTAG"` \| `"FRONLEICHNAM"` \| `"DEUTSCHEEINHEIT"` \| `"REFORMATIONSTAG"` \| `"ALLERHEILIGEN"` \| `"BUBETAG"` \| `"ERSTERWEIHNACHTSFEIERTAG"` \| `"ZWEITERWEIHNACHTSFEIERTAG"` \| `"WELTKINDERTAG"` \| `"WELTFRAUENTAG"` \| `"AUGSBURGER_FRIEDENSFEST"`)
### Region
Type: (`"BW"` \| `"BY"` \| `"BE"` \| `"BB"` \| `"HB"` \| `"HE"` \| `"HH"` \| `"MV"` \| `"NI"` \| `"NW"` \| `"RP"` \| `"SL"` \| `"SN"` \| `"ST"` \| `"SH"` \| `"TH"` \| `"BUND"` \| `"ALL"`)
As defined here: https://de.wikipedia.org/wiki/Land_(Deutschland)#Amtliche_bzw._Eigenbezeichnungen
The difference between BUND and ALL is defined as follows:
* "ALL" refers to every holiday which is valid in **at least** one region. So a holiday that only applies to one state will be included.
* "BUND" refers to holidays that are valid in every region ("bundesweit"). So a holiday that only applies to one state will not be included.
### Holiday
Type: {name: [HolidayType](#holidaytype), date: [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date), trans: function (lang: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?): [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), dateString: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), equals: function (date: [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)): [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)}
**Properties**
- `name` **[HolidayType](#holidaytype)**
- `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)**
- `trans` **function (lang: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?): [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `dateString` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `equals` **function (date: [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)): [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
### allHolidays
Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[HolidayType](#holidaytype)>
### allRegions
Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Region](#region)>
### TranslationTable
Map of [HolidayType](#holidaytype) to translation string.
Type: {}
## API
### addTranslation()
Adds a translation for the holidays (e.g. English).
This also allows overriding the German names.
Hint: Interpolates German for missing translations
**Parameters**
- `isoCode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** of the new language
- `newTranslation` **[TranslationTable](#translationtable)** map of {HolidayType} to translation stringg
### setLanguage()
Set a language to default language
**Parameters**
- `isoCode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
### getLanguage()
Get currently set language
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
### isSunOrHoliday()
Checks if a specific date is sunday or holiday.
**Parameters**
- `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)**
- `region` **[Region](#region)**
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
### isHoliday()
Check is specific date is holiday.
**Parameters**
- `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)**
- `region` **[Region](#region)** two character [Region](#region) code
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
### getHolidayByDate()
**Parameters**
- `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)**
- `region` **[Region](#region)** (optional, default `'ALL'`)
Returns **([Holiday](#holiday) | void)**
### isSpecificHoliday()
**Parameters**
- `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)**
- `holidayName` **[HolidayType](#holidaytype)**
- `region` **[Region](#region)** (optional, default `'ALL'`)
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
### getHolidays()
Returns all holidays of a year in a [Region](#region).
**Parameters**
- `year` **([number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))**
- `region` **[Region](#region)**
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Holiday](#holiday)>**
+113
View File
@@ -0,0 +1,113 @@
declare type Region =
| 'BW' // Baden-Württemberg
| 'BY' // Bayern
| 'BE' // Berlin
| 'BB' // Brandenburg
| 'HB' // Bremen
| 'HE' // Hessen
| 'HH' // Hamburg
| 'MV' // Mecklenburg-Vorpommern
| 'NI' // Niedersachsen
| 'NW' // Nordrhein-Westfalen
| 'RP' // Rheinland-Pfalz
| 'SL' // Saarland
| 'SN' // Sachsen
| 'ST' // Sachsen-Anhalt
| 'SH' // Schleswig-Holstein
| 'TH' // Thüringen
| 'BUND' // Gesamt-Deutschland
| 'AUGSBURG'
| 'ALL';
declare type Holiday = {
name: HolidayType;
date: Date;
trans?: (lang: string | undefined) => string; // deprecated;
translate: (lang?: string | undefined) => string;
dateString: string;
equals: (date: Date) => boolean;
};
declare type HolidayType =
| 'NEUJAHRSTAG'
| 'HEILIGEDREIKOENIGE'
| 'KARFREITAG'
| 'OSTERSONNTAG'
| 'OSTERMONTAG'
| 'TAG_DER_ARBEIT'
| 'CHRISTIHIMMELFAHRT'
| 'MARIAHIMMELFAHRT'
| 'PFINGSTSONNTAG'
| 'PFINGSTMONTAG'
| 'FRONLEICHNAM'
| 'DEUTSCHEEINHEIT'
| 'REFORMATIONSTAG'
| 'ALLERHEILIGEN'
| 'BUBETAG'
| 'ERSTERWEIHNACHTSFEIERTAG'
| 'ZWEITERWEIHNACHTSFEIERTAG';
/**
* Map of {@link HolidayType} to translation string.
*/
export type TranslationTable = {
[key: string]: string;
};
/**
* adds a translation for the holidays (e.g. english).
* This also allows to override the German names.
* Hint: Interpolates German for missing translations
* @param {string} isoCode of the new language
* @param {TranslationTable} newTranslation map of {HolidayType} to translation stringg
*/
declare function addTranslation(
isoCode: string,
newTranslation: TranslationTable,
): void;
/**
* Set a language to default language
* @param {string} isoCode
*/
declare function setLanguage(isoCode: string): void;
/**
* Get currently set language
* @returns {string}
*/
declare function getLanguage(): string;
// holidays api
/**
* Checks if a specific date is sunday or holiday.
* @param date
* @param region
* @returns {boolean}
*/
declare function isSunOrHoliday(date: Date, region: Region): boolean;
/**
* Check is specific date is holiday.
* @param date
* @param {Region} region two character {@link Region} code
* @returns {boolean}
*/
declare function isHoliday(date: Date, region: Region): boolean;
declare function getHolidayByDate(date: Date, region: Region): Holiday | void;
declare function isSpecificHoliday(
date: Date,
holidayName: HolidayType,
region: Region,
): boolean;
/**
* Returns all holidays of a year in a {@link Region}.
* @param year
* @param region
* @returns {Array.<Holiday>}
*/
declare function getHolidays(year: number | string, region: Region): Holiday[];
+53
View File
@@ -0,0 +1,53 @@
{
"name": "feiertagejs",
"version": "1.3.9",
"description": "A module to calculate German holidays made for node.js",
"type": "module",
"main": "build/feiertage.umd.cjs",
"module": "build/feiertage.js",
"types": "index.d.ts",
"scripts": {
"test": "vitest run --coverage",
"test:w": "vitest watch",
"format": "prettier --write \"{**/*,*}.{ts,json}\" \"!coverage/**\" \"!build/**\" \"!package.json\" \"!package-lock.json\" --cache",
"lint": "eslint \"src\" \"spec\"",
"build": "rollup -c"
},
"repository": {
"type": "git",
"url": "https://github.com/sfakir/feiertagejs"
},
"keywords": [
"node",
"holidays",
"feiertage",
"javascript"
],
"engines": {
"node": ">=8.0.0"
},
"author": "Simon Fakir",
"license": "MIT",
"bugs": {
"url": "https://github.com/sfakir/feiertagejs/issues"
},
"homepage": "https://github.com/sfakir/feiertagejs",
"devDependencies": {
"@vitest/coverage-c8": "^0.26.2",
"prettier": "^2.8.1",
"rollup": "^3.9.0",
"@rollup/plugin-typescript": "^10.0.1",
"typescript": "^4.9.4",
"vitest": "^0.26.2",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1",
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0"
},
"files": [
"build",
"docs.md",
"Readme.md",
"index.d.ts"
]
}
+20
View File
@@ -0,0 +1,20 @@
{
"name": "TIF22A_AnwProjekt_B",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"feiertagejs": "^1.3.9"
}
},
"node_modules/feiertagejs": {
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/feiertagejs/-/feiertagejs-1.3.9.tgz",
"integrity": "sha512-tUP+WBv2OWBhPwe3NfqwCtjMq+ym598a42tfqmL0FySswEb9xs96p2iKwqqx+lxKieu1njJBRZKsFm92bJhxZw==",
"engines": {
"node": ">=8.0.0"
}
}
}
}
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"feiertagejs": "^1.3.9"
}
}