Private
Public Access
1
0

Use first payment date and maturity date instead of origination date and term

Replace the term months field with a maturity date picker - users know
when their loan ends, not the month count. Compute termMonths from the
two dates. Rename "Origination Date" to "First Payment Date" and adjust
the amortization schedule so payment #1 falls on the entered date.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-14 17:06:21 -05:00
parent 7efeb4957b
commit 6ddecd7a99
3 changed files with 21 additions and 17 deletions
+2 -2
View File
@@ -187,11 +187,11 @@ public class LoanService : ILoanService
var dailyRate = loan.InterestRate / 100m / 365m;
var payment = loan.MonthlyPayment - (loan.EscrowAmount ?? 0);
var extra = loan.ExtraPayment ?? 0;
var previousDate = loan.OriginationDate;
var previousDate = loan.OriginationDate.AddMonths(-1);
for (int i = 1; i <= loan.TermMonths && balance > 0; i++)
{
var paymentDate = loan.OriginationDate.AddMonths(i);
var paymentDate = loan.OriginationDate.AddMonths(i - 1);
var days = (paymentDate - previousDate).Days;
var interest = balance * dailyRate * days;
var principal = Math.Min(payment + extra - interest, balance);