fix: convert dates to yyyy-MM-dd when opening received invoice edit form
ISO datetime strings from API caused "Invalid time value" in date picker. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -302,11 +302,20 @@ export default function ReceivedInvoices({ statsMonth, statsYear, uploadOpen, se
|
||||
}
|
||||
|
||||
// Edit handlers
|
||||
const toDateInput = (d: string | null | undefined): string => {
|
||||
if (!d) return ''
|
||||
const date = new Date(d)
|
||||
if (isNaN(date.getTime())) return ''
|
||||
return date.toISOString().split('T')[0]
|
||||
}
|
||||
|
||||
const openEdit = (inv: ReceivedInvoice) => {
|
||||
setEditInvoice({
|
||||
...inv,
|
||||
amount: String(inv.amount),
|
||||
vat_rate: String(inv.vat_rate),
|
||||
issue_date: toDateInput(inv.issue_date),
|
||||
due_date: toDateInput(inv.due_date),
|
||||
_originalStatus: inv.status,
|
||||
})
|
||||
setEditOpen(true)
|
||||
|
||||
Reference in New Issue
Block a user