dayjs-feiertage 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 fakir-tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # dayjs-feiertage
2
+
3
+
4
+ This is a wrapperlib for [feiertage.js](https://github.com/sfakir/feiertagejs) for dayjs to access German feiertage easily.
5
+
6
+
7
+ ## Installation
8
+
9
+ - [yarn](https://yarnpkg.com/en/): `yarn add dayjs-feiertage`
10
+ - [npm](https://www.npmjs.com/): `npm install dayjs-feiertage`
11
+
12
+ ## Quick Examples
13
+
14
+ ### ES Modules (Typescript/Javasript)
15
+
16
+ ```javascript
17
+ import dayjs from 'dayjs';
18
+ import dayjsFeiertage from './src/dayjs-feiertage';
19
+
20
+ dayjs.extend(dayjsFeiertage);
21
+
22
+ dayjs('2020-12-25').isHoliday('BUND') // true
23
+
24
+ // check if a day is a specific holiday
25
+ dayjs('2020-12-25').isSpecificHoliday( 'CHRISTIHIMMELFAHRT', 'ALL'); //false
26
+
27
+ dayjs('2020-12-25').getHolidaysOfYear( 'ALL'); // returns list of Holiday, see next nty
28
+ ```
29
+
30
+ One entry of the array contains:
31
+
32
+ ```javascript
33
+ [{
34
+ name: 'CHRISTIHIMMELFAHRT',
35
+ date: new Date('2023-05-17T22:00:00.000Z'),
36
+ dateString: '2023-05-18',
37
+ regions: [
38
+ 'BW', 'BY', 'BE',
39
+ 'BB', 'HB', 'HE',
40
+ 'HH', 'MV', 'NI',
41
+ 'NW', 'RP', 'SL',
42
+ 'SN', 'ST', 'SH',
43
+ 'TH', 'BUND', 'AUGSBURG',
44
+ 'ALL'
45
+ ],
46
+ translate: [Function: translate],
47
+ getNormalizedDate: [Function: getNormalizedDate],
48
+ equals: [Function: equals]
49
+ }
50
+ ]
51
+
52
+ ```
53
+
54
+ ## API doc
55
+
56
+ The full API doc can be found [here](docs.md).
57
+
58
+ ## Feedback and Questions
59
+
60
+ You have two options two give feedback or ask questions:
61
+
62
+ - Comment the official release [post](https://fakir.tech/de/feiertage-js-deutsche-feiertage-fuer-node-js-und-browser-javascript/)
63
+ - Open issues or pullrequests on [github](https://github.com/sfakir/feiertagejs)
64
+
65
+ ## Contributors
66
+
67
+ Thank you for contributing:
68
+
69
+ - thetric
70
+ - SteveOswald
71
+
72
+ ## Feedback
73
+
74
+ If you have any questions, feel free to open an issue.
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/dayjs-feiertage.ts
20
+ var dayjs_feiertage_exports = {};
21
+ __export(dayjs_feiertage_exports, {
22
+ default: () => dayjs_feiertage_default
23
+ });
24
+ module.exports = __toCommonJS(dayjs_feiertage_exports);
25
+ var import_feiertagejs = require("feiertagejs");
26
+ var dayjs_feiertage_default = (option = {}, dayjsClass) => {
27
+ dayjsClass.prototype.isHoliday = function(region) {
28
+ return (0, import_feiertagejs.isHoliday)(this.toDate(), region);
29
+ };
30
+ dayjsClass.prototype.isSpecificHoliday = function(holidayName, region) {
31
+ return (0, import_feiertagejs.isSpecificHoliday)(this.toDate(), holidayName, region);
32
+ };
33
+ dayjsClass.prototype.isSunOrHoliday = function(region) {
34
+ return (0, import_feiertagejs.isSunOrHoliday)(this.toDate(), region);
35
+ };
36
+ dayjsClass.prototype.getHolidaysOfYear = function(region) {
37
+ return (0, import_feiertagejs.getHolidays)(this.year(), region);
38
+ };
39
+ };
40
+ //# sourceMappingURL=dayjs-feiertage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/dayjs-feiertage.ts"],"sourcesContent":["import {\n getHolidays,\n Holiday,\n HolidayType,\n isHoliday,\n isSpecificHoliday,\n isSunOrHoliday,\n Region,\n} from \"feiertagejs\";\n\n// add custom plugin to dayjs' types\ndeclare module \"dayjs\" {\n interface Dayjs {\n isSunOrHoliday(region: Region): boolean;\n isHoliday(region: Region): boolean;\n isSpecificHoliday(holidayName: string, region: Region): boolean;\n getHolidaysOfYear(region: Region): Holiday[];\n \n }\n}\n\nexport default (option = {}, dayjsClass) => {\n dayjsClass.prototype.isHoliday = function (region: Region | null): boolean {\n return isHoliday(this.toDate(), region);\n };\n dayjsClass.prototype.isSpecificHoliday = function (\n holidayName: HolidayType,\n region: Region\n ) {\n return isSpecificHoliday(this.toDate(), holidayName, region);\n };\n dayjsClass.prototype.isSunOrHoliday = function (region: Region): boolean {\n return isSunOrHoliday(this.toDate(), region);\n };\n dayjsClass.prototype.getHolidaysOfYear = function (\n region: Region\n ): Holiday[] {\n return getHolidays(this.year(), region);\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAQO;AAaP,IAAO,0BAAQ,CAAC,SAAS,CAAC,GAAG,eAAe;AAC1C,aAAW,UAAU,YAAY,SAAU,QAAgC;AACzE,eAAO,8BAAU,KAAK,OAAO,GAAG,MAAM;AAAA,EACxC;AACA,aAAW,UAAU,oBAAoB,SACvC,aACA,QACA;AACA,eAAO,sCAAkB,KAAK,OAAO,GAAG,aAAa,MAAM;AAAA,EAC7D;AACA,aAAW,UAAU,iBAAiB,SAAU,QAAyB;AACvE,eAAO,mCAAe,KAAK,OAAO,GAAG,MAAM;AAAA,EAC7C;AACA,aAAW,UAAU,oBAAoB,SACvC,QACW;AACX,eAAO,gCAAY,KAAK,KAAK,GAAG,MAAM;AAAA,EACxC;AACF;","names":[]}
@@ -0,0 +1,25 @@
1
+ // src/dayjs-feiertage.ts
2
+ import {
3
+ getHolidays,
4
+ isHoliday,
5
+ isSpecificHoliday,
6
+ isSunOrHoliday
7
+ } from "feiertagejs";
8
+ var dayjs_feiertage_default = (option = {}, dayjsClass) => {
9
+ dayjsClass.prototype.isHoliday = function(region) {
10
+ return isHoliday(this.toDate(), region);
11
+ };
12
+ dayjsClass.prototype.isSpecificHoliday = function(holidayName, region) {
13
+ return isSpecificHoliday(this.toDate(), holidayName, region);
14
+ };
15
+ dayjsClass.prototype.isSunOrHoliday = function(region) {
16
+ return isSunOrHoliday(this.toDate(), region);
17
+ };
18
+ dayjsClass.prototype.getHolidaysOfYear = function(region) {
19
+ return getHolidays(this.year(), region);
20
+ };
21
+ };
22
+ export {
23
+ dayjs_feiertage_default as default
24
+ };
25
+ //# sourceMappingURL=dayjs-feiertage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/dayjs-feiertage.ts"],"sourcesContent":["import {\n getHolidays,\n Holiday,\n HolidayType,\n isHoliday,\n isSpecificHoliday,\n isSunOrHoliday,\n Region,\n} from \"feiertagejs\";\n\n// add custom plugin to dayjs' types\ndeclare module \"dayjs\" {\n interface Dayjs {\n isSunOrHoliday(region: Region): boolean;\n isHoliday(region: Region): boolean;\n isSpecificHoliday(holidayName: string, region: Region): boolean;\n getHolidaysOfYear(region: Region): Holiday[];\n \n }\n}\n\nexport default (option = {}, dayjsClass) => {\n dayjsClass.prototype.isHoliday = function (region: Region | null): boolean {\n return isHoliday(this.toDate(), region);\n };\n dayjsClass.prototype.isSpecificHoliday = function (\n holidayName: HolidayType,\n region: Region\n ) {\n return isSpecificHoliday(this.toDate(), holidayName, region);\n };\n dayjsClass.prototype.isSunOrHoliday = function (region: Region): boolean {\n return isSunOrHoliday(this.toDate(), region);\n };\n dayjsClass.prototype.getHolidaysOfYear = function (\n region: Region\n ): Holiday[] {\n return getHolidays(this.year(), region);\n };\n};\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAaP,IAAO,0BAAQ,CAAC,SAAS,CAAC,GAAG,eAAe;AAC1C,aAAW,UAAU,YAAY,SAAU,QAAgC;AACzE,WAAO,UAAU,KAAK,OAAO,GAAG,MAAM;AAAA,EACxC;AACA,aAAW,UAAU,oBAAoB,SACvC,aACA,QACA;AACA,WAAO,kBAAkB,KAAK,OAAO,GAAG,aAAa,MAAM;AAAA,EAC7D;AACA,aAAW,UAAU,iBAAiB,SAAU,QAAyB;AACvE,WAAO,eAAe,KAAK,OAAO,GAAG,MAAM;AAAA,EAC7C;AACA,aAAW,UAAU,oBAAoB,SACvC,QACW;AACX,WAAO,YAAY,KAAK,KAAK,GAAG,MAAM;AAAA,EACxC;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "dayjs-feiertage",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsup",
13
+ "test": "jest"
14
+ },
15
+ "author": "",
16
+ "license": "ISC",
17
+ "dependencies": {
18
+ "dayjs": "^1.11.10",
19
+ "feiertagejs": "^1.4.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/jest": "^29.5.11",
23
+ "jest": "^29.7.0",
24
+ "ts-jest": "^29.1.1",
25
+ "tsup": "^8.0.1",
26
+ "typescipt": "^1.0.0"
27
+ }
28
+ }