hbotutil
Version:
Delivery/pickup date helpers for Germany (weekends + union of major state holidays)
48 lines (37 loc) • 1.26 kB
Markdown
# HBotUtil
Delivery/pickup date helpers for Germany (weekends + union of major state holidays).
## Install
```bash
npm install hbotutil
# or
pnpm add hbotutil
# or
yarn add hbotutil
```
## Usage
### Node (CommonJS)
```js
const { pickupAnchoredShipmentDates, deliveryAnchoredShipmentDates } = require('hbotutil');
console.log(pickupAnchoredShipmentDates('2025-08-21'));
// => { pickupDate: '2025-08-21', deliveryDate: '2025-08-22' }
```
### ESM
```js
import { pickupAnchoredShipmentDates, deliveryAnchoredShipmentDates } from 'hbotutil';
```
### Browser (UMD)
```html
<script src="https://unpkg.com/hbotutil"></script>
<script>
const { pickupAnchoredShipmentDates } = NRShip;
console.log(pickupAnchoredShipmentDates('2025-08-21'));
</script>
```
## API
- `pickupAnchoredShipmentDates(requestedPickupDate: string|Date)`
- Returns the same day if it’s a working day, otherwise the next working day; delivery is the next working day after pickup.
- `deliveryAnchoredShipmentDates(requestedDeliveryDate: string|Date)`
- Returns the same day if it’s a working day, otherwise the next working day; pickup is the previous working day before delivery.
Working days exclude weekends and a union of major German federal-state holidays.
## License
MIT