@zenuinebit/rent-schedule
v0.1.0
Published
Rent schedules with escalation, proration, deposits and late fees. Works in minor units.
Readme
@zenuinebit/rent-schedule
Rent for a lease month by month, with proration, yearly increases, payments, late fees and deposit settlement. Amounts are integers in minor units (see @zenuinebit/money). Dates are "YYYY-MM-DD" strings.
import { schedule, applyPayments, lateFee, settleDeposit } from "@zenuinebit/rent-schedule";
const lease = schedule({
startDate: "2025-01-15",
months: 11, // or endDate: "2025-12-14"
monthlyRent: 2_500_000, // 25,000.00 in minor units
dueDay: 5,
escalation: { percent: 5, everyMonths: 12 }, // optional
});
lease.rows; // [{ number, periodStart, periodEnd, days, dueDate, monthlyRent, prorated, amount }]
lease.total;
const ledger = applyPayments(lease.rows, [{ date: "2025-01-15", amount: 2_500_000 }]);
ledger.rows[0].status; // "paid" | "partial" | "unpaid"
ledger.outstanding; // unpaid rent
ledger.credit; // paid in advance
lateFee({ amountDue: 2_500_000, dueDate: "2025-03-05", paidDate: "2025-03-12" },
{ graceDays: 3, flat: 50_000, perDay: 10_000, cap: 200_000 });
// { daysLate: 4, fee: 90000 }
settleDeposit(5_000_000, [{ reason: "Repainting", amount: 800_000 }]);
// { deducted: 800000, refund: 4200000, shortfall: 0 }How it works
- Rent is billed per calendar month. A first or last month that is only partly covered is prorated by days:
rent x days / days in that month, rounded to the minor unit. - Escalation happens at the start of every Nth billing period and compounds on the previous rounded rent, so a lease that starts mid-month increases on a month boundary, not on the anniversary.
applyPaymentspays the oldest rent first and splits one payment over several months if needed.lateFeecounts days after the grace period. Flat and percent fees apply once the payment is late; per-day fees grow daily;caplimits the total.- Dates are plain calendar dates, so there are no time-zone surprises.
Not included: interest on late rent, tax or TDS on rent, maintenance charges, and rent-control limits. Your lease terms and local law decide those.
