Skip to content

Commit

Permalink
feat: cashflow tranasction date format
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Jun 17, 2024
1 parent 125dff8 commit 2ad7710
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ export class CashflowTransactionTransformer extends Transformer {
* @returns {string[]}
*/
public includeAttributes = (): string[] => {
return ['formattedAmount', 'transactionTypeFormatted'];
return [
'formattedAmount',
'transactionTypeFormatted',
'formattedDate',
'formattedCreatedAt',
];
};

/**
Expand All @@ -24,10 +29,28 @@ export class CashflowTransactionTransformer extends Transformer {

/**
* Formatted transaction type.
* @param transaction
* @param transaction
* @returns {string}
*/
protected transactionTypeFormatted = (transaction) => {
return this.context.i18n.__(transaction.transactionTypeFormatted);
}
};

/**
* Retrieve the formatted transaction date.
* @param invoice
* @returns {string}
*/
protected formattedDate = (invoice): string => {
return this.formatDate(invoice.date);
};

/**
* Retrieve the formatted created at date.
* @param invoice
* @returns {string}
*/
protected formattedCreatedAt = (invoice): string => {
return this.formatDate(invoice.createdAt);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export default class OrganizationService {
): IOrganizationBuildDTO {
return {
...buildDTO,
dateFormat: defaultTo(buildDTO.dateFormat, 'DD/MM/yyyy'),
dateFormat: defaultTo(buildDTO.dateFormat, 'DD MMM yyyy'),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function CashflowTransactionDrawerHeader() {
</DetailItem>

<DetailItem label={<T id={'date'} />}>
<FormatDate value={cashflowTransaction.date} />
{cashflowTransaction.formatted_date}
</DetailItem>

<DetailItem name={'reference-no'} label={<T id={'reference_no'} />}>
Expand Down

0 comments on commit 2ad7710

Please sign in to comment.