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
+15 -12
View File
@@ -84,7 +84,7 @@
<div>{{ loanDetail.termMonths }} months</div>
</v-col>
<v-col cols="6" md="3">
<div class="text-medium-emphasis text-caption">Origination Date</div>
<div class="text-medium-emphasis text-caption">First Payment Date</div>
<div>{{ formatDate(loanDetail.originationDate) }}</div>
</v-col>
<v-col cols="6" md="3">
@@ -220,9 +220,9 @@
</v-alert>
<v-text-field v-model.number="loanForm.originalBalance" label="Original Balance" type="number" prefix="$" />
<v-text-field v-model.number="loanForm.interestRate" label="Interest Rate (%)" type="number" suffix="%" step="0.125" />
<v-text-field v-model.number="loanForm.termMonths" label="Term (months)" type="number" />
<v-text-field v-model.number="loanForm.monthlyPayment" label="Monthly Payment" type="number" prefix="$" />
<v-text-field v-model="loanForm.originationDate" label="Origination Date" type="date" />
<v-text-field v-model="loanForm.originationDate" label="First Payment Date" type="date" />
<v-text-field v-model="loanForm.maturityDate" label="Maturity Date" type="date" />
<v-text-field v-model.number="loanForm.escrowAmount" label="Escrow Amount (optional)" type="number" prefix="$" />
<v-text-field v-model.number="loanForm.extraPayment" label="Extra Payment (optional)" type="number" prefix="$" />
</v-card-text>
@@ -289,9 +289,9 @@ const payoffForm = ref({
const loanForm = ref({
originalBalance: 0,
interestRate: 0,
termMonths: 360,
monthlyPayment: 0,
originationDate: '',
maturityDate: '',
escrowAmount: null as number | null,
extraPayment: null as number | null,
})
@@ -326,9 +326,9 @@ async function openSetupDialog() {
loanForm.value = {
originalBalance: 0,
interestRate: 0,
termMonths: 360,
monthlyPayment: 0,
originationDate: new Date().toISOString().split('T')[0],
maturityDate: '',
escrowAmount: null,
extraPayment: null,
}
@@ -338,7 +338,6 @@ async function openSetupDialog() {
const { data } = await loansApi.getLoanDefaults(props.id)
if (data.originalBalance > 0) loanForm.value.originalBalance = data.originalBalance
if (data.interestRate > 0) loanForm.value.interestRate = data.interestRate
if (data.termMonths > 0) loanForm.value.termMonths = data.termMonths
prePopulated.value = data.hasSyncData
} catch {
// Fall back to zero defaults
@@ -354,9 +353,9 @@ function openEditDialog() {
loanForm.value = {
originalBalance: loanDetail.value.originalBalance,
interestRate: loanDetail.value.interestRate,
termMonths: loanDetail.value.termMonths,
monthlyPayment: loanDetail.value.monthlyPayment,
originationDate: loanDetail.value.originationDate.split('T')[0],
maturityDate: loanDetail.value.maturityDate.split('T')[0],
escrowAmount: loanDetail.value.escrowAmount,
extraPayment: loanDetail.value.extraPayment,
}
@@ -367,13 +366,17 @@ async function saveLoanDetail() {
if (!props.id) return
saving.value = true
try {
const [year, month, day] = loanForm.value.originationDate.split('-').map(Number)
const maturityDate = new Date(Date.UTC(year, month - 1 + loanForm.value.termMonths, day))
const [sY, sM, sD] = loanForm.value.originationDate.split('-').map(Number)
const [eY, eM, eD] = loanForm.value.maturityDate.split('-').map(Number)
const termMonths = (eY - sY) * 12 + (eM - sM) + 1
const payload = {
...loanForm.value,
originationDate: new Date(Date.UTC(year, month - 1, day)).toISOString(),
maturityDate: maturityDate.toISOString(),
originalBalance: loanForm.value.originalBalance,
interestRate: loanForm.value.interestRate,
termMonths,
monthlyPayment: loanForm.value.monthlyPayment,
originationDate: new Date(Date.UTC(sY, sM - 1, sD)).toISOString(),
maturityDate: new Date(Date.UTC(eY, eM - 1, eD)).toISOString(),
escrowAmount: loanForm.value.escrowAmount || undefined,
extraPayment: loanForm.value.extraPayment || undefined,
}