CalOohPay - Calculate Out-of-Hours Pay
This is the main entry point that exports all functionality. For browser/web applications, use 'caloohpay/core' instead. For Node.js-specific features, use 'caloohpay/node'.
CalOohPay now provides three import paths:
caloohpay
caloohpay/core
caloohpay/node
Node.js usage (backward compatible):
import { ConfigLoader, OnCallPaymentsCalculator } from 'caloohpay';const loader = new ConfigLoader();const rates = loader.loadRates();const calculator = new OnCallPaymentsCalculator(rates.weekdayRate, rates.weekendRate); Copy
import { ConfigLoader, OnCallPaymentsCalculator } from 'caloohpay';const loader = new ConfigLoader();const rates = loader.loadRates();const calculator = new OnCallPaymentsCalculator(rates.weekdayRate, rates.weekendRate);
Browser/Next.js usage (new in v2.1.0):
import { OnCallUser, OnCallPeriod, OnCallPaymentsCalculator } from 'caloohpay/core';const user = new OnCallUser('id', 'John Doe', [ new OnCallPeriod(startDate, endDate, 'Europe/London')]);const calculator = new OnCallPaymentsCalculator(60, 90);const amount = calculator.calculateOnCallPayment(user); Copy
import { OnCallUser, OnCallPeriod, OnCallPaymentsCalculator } from 'caloohpay/core';const user = new OnCallUser('id', 'John Doe', [ new OnCallPeriod(startDate, endDate, 'Europe/London')]);const calculator = new OnCallPaymentsCalculator(60, 90);const amount = calculator.calculateOnCallPayment(user);
CalOohPay - Calculate Out-of-Hours Pay
This is the main entry point that exports all functionality. For browser/web applications, use 'caloohpay/core' instead. For Node.js-specific features, use 'caloohpay/node'.
Remarks
Package Structure (v2.1.0+)
CalOohPay now provides three import paths:
caloohpay- Everything (backward compatible, Node.js only)caloohpay/core- Browser-compatible core (calculator, models, utilities)caloohpay/node- Node.js-specific features (ConfigLoader, CsvWriter, API)Example
Node.js usage (backward compatible):
Example
Browser/Next.js usage (new in v2.1.0):