Skip to content

Commit

Permalink
Merge pull request #167 from Holo-Host/fix/invoice-due-date-fix
Browse files Browse the repository at this point in the history
fix/invoice due date fix
  • Loading branch information
zeeshan595 authored Jul 19, 2024
2 parents 8c1888d + 37e0f2b commit bfa93d8
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/pages/InvoicesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ const headersMap = computed(
}
],
[
'expirationDate',
'formattedExpirationDate',
{
key: 'expirationDate',
key: 'formattedExpirationDate',
label: t('invoices.headers.due'),
isVisibleOnMobile: false,
isSortable: true,
Expand Down Expand Up @@ -129,22 +129,26 @@ const invoices = computed(() => {
: earningsStore.unpaidInvoices
return Array.isArray(rawInvoices)
? rawInvoices.map((invoice) => ({
...invoice,
formattedId: `...${invoice.id.substring(invoice.id.length - kVisibleHashLength)}`,
happ: invoice.happ.name,
formattedExpirationDate: invoice.expirationDate
? dayjs(new Date(invoice.expirationDate / kMsInSecond)).format(kDefaultDateFormat)
: '-',
amount: Number(invoice.amount),
formattedCompletedDate: dayjs(invoice.completedDate / kMsInSecond).format(
kDefaultDateFormat
),
formattedCreatedDate: dayjs(invoice.createdDate / kMsInSecond).format(kDefaultDateFormat),
formattedAmount:
invoice.amount && Number(invoice.amount) ? formatCurrency(Number(invoice.amount)) : 0,
status: t(isPaidInvoices.value ? 'invoices.status.paid' : 'invoices.status.unpaid')
}))
? rawInvoices.map((invoice) => {
const note = JSON.parse(invoice.note);
const expirationDate = note['invoice_due_date'] ? new Date(note['invoice_due_date'] * 1_000) : 'N/A';
return {
...invoice,
formattedId: `...${invoice.id.substring(invoice.id.length - kVisibleHashLength)}`,
happ: invoice.happ.name,
formattedExpirationDate: expirationDate
? dayjs(expirationDate).format(kDefaultDateFormat)
: '-',
amount: Number(invoice.amount),
formattedCompletedDate: dayjs(invoice.completedDate / kMsInSecond).format(
kDefaultDateFormat
),
formattedCreatedDate: dayjs(invoice.createdDate / kMsInSecond).format(kDefaultDateFormat),
formattedAmount:
invoice.amount && Number(invoice.amount) ? formatCurrency(Number(invoice.amount)) : 0,
status: t(isPaidInvoices.value ? 'invoices.status.paid' : 'invoices.status.unpaid')
}
})
: []
})
Expand Down

0 comments on commit bfa93d8

Please sign in to comment.