Private
Public Access
1
0

Fix date timezone shift in loan detail maturity date computation

Parse date string components directly and use Date.UTC() to avoid
local timezone interpretation that shifts dates by a day in western
timezones when using new Date() with date-only strings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-14 16:33:46 -05:00
parent 3bb9c688ed
commit 2ae12770cf
+3 -3
View File
@@ -367,12 +367,12 @@ async function saveLoanDetail() {
if (!props.id) return
saving.value = true
try {
const originDate = new Date(loanForm.value.originationDate)
const maturityDate = new Date(originDate)
maturityDate.setMonth(maturityDate.getMonth() + loanForm.value.termMonths)
const [year, month, day] = loanForm.value.originationDate.split('-').map(Number)
const maturityDate = new Date(Date.UTC(year, month - 1 + loanForm.value.termMonths, day))
const payload = {
...loanForm.value,
originationDate: new Date(Date.UTC(year, month - 1, day)).toISOString(),
maturityDate: maturityDate.toISOString(),
escrowAmount: loanForm.value.escrowAmount || undefined,
extraPayment: loanForm.value.extraPayment || undefined,