From d3b3899f71a886a52343be5cbf2a40f76e8834d1 Mon Sep 17 00:00:00 2001 From: Julian Maurer Date: Mon, 29 Sep 2025 16:12:28 +0200 Subject: [PATCH 1/3] Update README.md --- CHANGELOG.MD | 0 README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.MD diff --git a/CHANGELOG.MD b/CHANGELOG.MD new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index e72f9b3..f6802e4 100644 --- a/README.md +++ b/README.md @@ -1 +1,96 @@ -# deadlines \ No newline at end of file +# epilot Contract Switching Deadlines Utilities + +A TypeScript library for handling German energy market compliance requirements, specifically supplier switching deadlines as defined by **GPKE** (power) and **GeLi Gas** (natural gas). + +This library is regularly updated to reflect the latest calendar updates. You can find the changelog at [CHANGELOG.md](CHANGELOG.md). + +## ✨ Features + +πŸ“… **Automatic calculation of switching deadlines** + +Handles supplier switching deadlines for power and gas according to GPKE and GeLi Gas. + +πŸ”„ **Use-case and commodity-aware** + +Separate rules for **power (Strom)** and **gas (Gas)**, covering multiple switching scenarios: +- Supplier switch (Lieferantenwechsel) +- Relocation (Umzug) +- New connection / initial supply (Neuanlage / Erstbelieferung) + +πŸ•‘ **Public and special holidays included** + +Accounts for one-time public holidays and special holidays (_Sonderfeiertage_), e.g.: +- 8 May 2025 (_Tag der Befreiung_, Berlin public holiday) +- 6 June 2025 (_Einmaliger Sonderfeiertag zur EinfΓΌhrung des LFW24_) + +## πŸš€ Quick Start + +Install via `npm`, `yarn`, or `pnpm`: + +```bash +npm install @epilot/switching-deadlines +``` + +The library provides helper functions for simple calculations. +With `calculateDeadline`, you can calculate the deadline for a given commodity, use case, and date: + +```typescript +import { calculateDeadline, Commodity, UseCase } from '@epilot/switching-deadlines'; + +const result = calculateDeadline({ + commodity: Commodity.POWER, + useCase: UseCase.SWITCH, + requiresTermination: true, + fromDate: '2025-10-01' +}); + +console.log(result); // '2025-10-07' +``` + +For multiple calculations, use the `DeadlineCalculator` class directly: + +```typescript +import { DeadlineCalculator, Commodity, UseCase } from '@epilot/switching-deadlines'; + +const calculator = new DeadlineCalculator() +const today = new Date() + +const relocationResult = calculator.calculateEarliestStartDate( + { + commodity: Commodity.POWER, + useCase: UseCase.RELOCATION, + requiresTermination: false + }, + today +) + +const switchResult = calculator.calculateEarliestStartDate( + { + commodity: Commodity.POWER, + useCase: UseCase.SWITCH, + requiresTermination: true + }, + today +) + +console.log( + `${`The earliest start date is ${relocationResult.earliestStartDate} for relocation and ${switchResult.earliestStartDate} for switching`}` +) +``` + +## πŸ“– Documentation + +Comprehensive usage examples and background information are available in the πŸ‘‰ [epilot dev center](https://docs.epilot.io/docs/deadlines/intro). + +## πŸ“œ Disclaimer + +This library is provided as an open-source contribution to the community to support flexibility when building custom systems around the epilot Energy XRM. It is not intended as a standalone product. Support is only provided for epilot customers. + +If you are an active epilot contract, you can alternatively use our [Switching Deadlines REST API](https://docs.epilot.io/api/deadlines), which offers the same logic as a web service. + +For questions or feedback regarding this library, please reach out to the epilot team. + +--- + + +Built with ❀️ love & dedication πŸ”₯ by team Tauro at epilot. From e0c54697dbd5a7cc6bff27049f2b7d49430509f3 Mon Sep 17 00:00:00 2001 From: "Julian J. Maurer" Date: Mon, 29 Sep 2025 16:36:06 +0200 Subject: [PATCH 2/3] Create build-and-test.js.yml Add a workflow to build and test --- .github/workflows/build-and-test.js.yml | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/build-and-test.js.yml diff --git a/.github/workflows/build-and-test.js.yml b/.github/workflows/build-and-test.js.yml new file mode 100644 index 0000000..8396474 --- /dev/null +++ b/.github/workflows/build-and-test.js.yml @@ -0,0 +1,36 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Build and Test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22.x, 24.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + - name: Install dependencies + run: pnpm install + - name: Run tests + run: pnpm test From 26418e5bebb7bd8bd94ef8ad7172eba9a27d498a Mon Sep 17 00:00:00 2001 From: "Julian J. Maurer" Date: Mon, 29 Sep 2025 16:37:16 +0200 Subject: [PATCH 3/3] Update build-and-test.js.yml Remove pnpm version from workflow --- .github/workflows/build-and-test.js.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-and-test.js.yml b/.github/workflows/build-and-test.js.yml index 8396474..998fbdd 100644 --- a/.github/workflows/build-and-test.js.yml +++ b/.github/workflows/build-and-test.js.yml @@ -23,8 +23,6 @@ jobs: - uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 - with: - version: 10 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: