Skip to content

Commit

Permalink
bugfix period wrongly formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
nbittich committed Apr 28, 2023
1 parent 731e96b commit 1d0673a
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class InvoiceSummaryComponent implements OnInit, OnDestroy {
constructor(
private invoiceService: InvoiceService,
@Inject(PLATFORM_ID) private platformId: any
) {}
) { }

ngOnDestroy(): void {
this.summary$ = null;
Expand All @@ -33,7 +33,7 @@ export class InvoiceSummaryComponent implements OnInit, OnDestroy {
responsive: true,
displayModeBar: false,
};
const layout = (title: string, callback = (_) => {}) => {
const layout = (title: string, callback = (_) => { }) => {
let l = {
barmode: 'group',
dragmode: 'zoom',
Expand Down Expand Up @@ -88,7 +88,7 @@ export class InvoiceSummaryComponent implements OnInit, OnDestroy {
const invoicesGroupByYear = invoicesOrderedByDateAsc.reduce((group, invoice) => {
const dateOfInvoice = new Date(invoice.dateOfInvoice);
const year = dateOfInvoice.getFullYear();
const { totalAmountOfWork, totalExclVat,numberOfInvoices} = group.get(year) || {
const { totalAmountOfWork, totalExclVat, numberOfInvoices } = group.get(year) || {
totalAmountOfWork: 0,
totalExclVat: 0,
numberOfInvoices: 0
Expand Down Expand Up @@ -122,7 +122,13 @@ export class InvoiceSummaryComponent implements OnInit, OnDestroy {
}

findPeriod(invoice) {
return invoice?.invoiceTable?.find((t) => t.period?.length)?.period;
let period = invoice?.invoiceTable?.find((t) => t.period?.length)?.period;
// todo dirty bugfix for a single invoice
let periodBug = period.split('-');
if (periodBug?.length && periodBug.length === 2) {
period = periodBug[1] + "/" + periodBug[0];
}
return period;
}

findAmount(invoice) {
Expand Down

0 comments on commit 1d0673a

Please sign in to comment.