diff --git a/src/app/pages/accounts/account-details/account-details.component.html b/src/app/pages/accounts/account-details/account-details.component.html index a784822..6f646d2 100644 --- a/src/app/pages/accounts/account-details/account-details.component.html +++ b/src/app/pages/accounts/account-details/account-details.component.html @@ -34,7 +34,7 @@ {{account?.vcard?.fn[0].value}} Balance: {{account?.balance | tokenRatio}} SRF - Created: {{account?.date_registered | date}} + Created: {{account?.date_registered | unixDate}} Address: {{accountAddress}} Copy @@ -210,7 +210,7 @@ {{account?.vcard?.fn[0].value}} {{account?.balance | tokenRatio}} - {{account?.date_registered | date}} + {{account?.date_registered | unixDate}} {{accountStatus}} @@ -275,7 +275,7 @@ Created - {{transaction?.tx.timestamp | date}} + {{transaction?.tx.timestamp | unixDate}} @@ -337,7 +337,7 @@ CREATED - {{user?.date_registered | date}} + {{user?.date_registered | unixDate}} diff --git a/src/app/pages/accounts/accounts.component.html b/src/app/pages/accounts/accounts.component.html index 7252fcf..43628aa 100644 --- a/src/app/pages/accounts/accounts.component.html +++ b/src/app/pages/accounts/accounts.component.html @@ -56,7 +56,7 @@ CREATED - {{user?.date_registered | date}} + {{user?.date_registered | unixDate}} diff --git a/src/app/pages/transactions/transaction-details/transaction-details.component.html b/src/app/pages/transactions/transaction-details/transaction-details.component.html index 87e178b..39f90e1 100644 --- a/src/app/pages/transactions/transaction-details/transaction-details.component.html +++ b/src/app/pages/transactions/transaction-details/transaction-details.component.html @@ -66,7 +66,7 @@ Success: {{transaction.tx.success}}
  • - Timestamp: {{transaction.tx.timestamp | date}} + Timestamp: {{transaction.tx.timestamp | unixDate}}

  • diff --git a/src/app/pages/transactions/transactions.component.html b/src/app/pages/transactions/transactions.component.html index 7491a36..23bbe77 100644 --- a/src/app/pages/transactions/transactions.component.html +++ b/src/app/pages/transactions/transactions.component.html @@ -66,7 +66,7 @@ Created - {{transaction?.tx.timestamp | date}} + {{transaction?.tx.timestamp | unixDate}} diff --git a/src/app/shared/_pipes/unix-date.pipe.spec.ts b/src/app/shared/_pipes/unix-date.pipe.spec.ts new file mode 100644 index 0000000..3a2e039 --- /dev/null +++ b/src/app/shared/_pipes/unix-date.pipe.spec.ts @@ -0,0 +1,8 @@ +import { UnixDatePipe } from './unix-date.pipe'; + +describe('UnixDatePipe', () => { + it('create an instance', () => { + const pipe = new UnixDatePipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/src/app/shared/_pipes/unix-date.pipe.ts b/src/app/shared/_pipes/unix-date.pipe.ts new file mode 100644 index 0000000..b2bb75e --- /dev/null +++ b/src/app/shared/_pipes/unix-date.pipe.ts @@ -0,0 +1,10 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'unixDate', +}) +export class UnixDatePipe implements PipeTransform { + transform(timestamp: number, ...args: unknown[]): any { + return new Date(timestamp * 1000).toLocaleDateString('en-GB'); + } +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index f27267f..353faf8 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -12,6 +12,7 @@ import { ErrorDialogComponent } from '@app/shared/error-dialog/error-dialog.comp import { MatDialogModule } from '@angular/material/dialog'; import { SafePipe } from '@app/shared/_pipes/safe.pipe'; import { NetworkStatusComponent } from './network-status/network-status.component'; +import { UnixDatePipe } from './_pipes/unix-date.pipe'; @NgModule({ declarations: [ @@ -24,6 +25,7 @@ import { NetworkStatusComponent } from './network-status/network-status.componen ErrorDialogComponent, SafePipe, NetworkStatusComponent, + UnixDatePipe, ], exports: [ TopbarComponent, @@ -33,6 +35,7 @@ import { NetworkStatusComponent } from './network-status/network-status.componen TokenRatioPipe, SafePipe, NetworkStatusComponent, + UnixDatePipe, ], imports: [CommonModule, RouterModule, MatIconModule, MatDialogModule], })