Skip to content

Commit

Permalink
improvement date pension
Browse files Browse the repository at this point in the history
  • Loading branch information
soker90 committed Apr 19, 2023
1 parent 7d5e69d commit 503b081
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const PensionTransactionsTable = ({ transactions }: { transactions: PensionTrans
<MainCard sx={{ mt: 2 }} content={false}>
<TableMaterial
columns={[
{ title: 'Fecha', render: ({ date }) => format.dateShort(date) },
{ title: 'Fecha', render: ({ date }) => format.date(date) },
{ title: 'Empresa (€)', render: ({ companyAmount }) => format.euro(companyAmount) },
{ title: 'Empresa (uds)', field: 'companyUnits' },
{ title: 'Empleado (€)', render: ({ employeeAmount }) => format.euro(employeeAmount) },
Expand Down
13 changes: 13 additions & 0 deletions packages/client/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ export const dateShort = (cell: number) => {
})
}

/* xD */
export const date = (cell: number) => {
if (!cell) {
return null
}

return new Date(cell).toLocaleDateString('es-ES', {
day: '2-digit',
month: '2-digit',
year: 'numeric'
})
}

export const monthToNumber = (month?: number | string): string => {
if (!month && month !== 0) return ''
const date = new Date()
Expand Down

0 comments on commit 503b081

Please sign in to comment.