Fix timestam.

This commit is contained in:
Spencer Ofwiti 2021-05-19 15:35:28 +03:00
parent 4e06b42cc6
commit 5baffa5fef
7 changed files with 28 additions and 7 deletions

View File

@ -34,7 +34,7 @@
<strong> {{account?.vcard?.fn[0].value}} </strong>
</h3>
<span class="ml-auto"><strong>Balance:</strong> {{account?.balance | tokenRatio}} SRF</span>
<span class="ml-2"><strong>Created:</strong> {{account?.date_registered | date}}</span>
<span class="ml-2"><strong>Created:</strong> {{account?.date_registered | unixDate}}</span>
<span class="ml-2"><strong>Address:</strong>
<a href="{{bloxbergLink}}" target="_blank"> {{accountAddress}} </a>
<img src="assets/images/checklist.svg" class="ml-2" height="20rem" (click)="copyAddress()" alt="Copy">
@ -210,7 +210,7 @@
<tr>
<td>{{account?.vcard?.fn[0].value}}</td>
<td>{{account?.balance | tokenRatio}}</td>
<td>{{account?.date_registered | date}}</td>
<td>{{account?.date_registered | unixDate}}</td>
<td>
<span *ngIf="accountStatus === 'active'" class="badge badge-success badge-pill">
{{accountStatus}}
@ -275,7 +275,7 @@
<ng-container matColumnDef="created">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Created </th>
<td mat-cell *matCellDef="let transaction"> {{transaction?.tx.timestamp | date}} </td>
<td mat-cell *matCellDef="let transaction"> {{transaction?.tx.timestamp | unixDate}} </td>
</ng-container>
<ng-container matColumnDef="type">
@ -337,7 +337,7 @@
<ng-container matColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header> CREATED </mat-header-cell>
<mat-cell *matCellDef="let user"> {{user?.date_registered | date}} </mat-cell>
<mat-cell *matCellDef="let user"> {{user?.date_registered | unixDate}} </mat-cell>
</ng-container>
<ng-container matColumnDef="balance">

View File

@ -56,7 +56,7 @@
<ng-container matColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header> CREATED </mat-header-cell>
<mat-cell *matCellDef="let user"> {{user?.date_registered | date}} </mat-cell>
<mat-cell *matCellDef="let user"> {{user?.date_registered | unixDate}} </mat-cell>
</ng-container>
<ng-container matColumnDef="balance">

View File

@ -66,7 +66,7 @@
<span>Success: {{transaction.tx.success}}</span>
</li>
<li class="list-group-item">
<span>Timestamp: {{transaction.tx.timestamp | date}}</span>
<span>Timestamp: {{transaction.tx.timestamp | unixDate}}</span>
</li>
</ul><br>
<div class="mb-3">

View File

@ -66,7 +66,7 @@
<ng-container matColumnDef="created">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Created </th>
<td mat-cell *matCellDef="let transaction"> {{transaction?.tx.timestamp | date}} </td>
<td mat-cell *matCellDef="let transaction"> {{transaction?.tx.timestamp | unixDate}} </td>
</ng-container>
<ng-container matColumnDef="type">

View File

@ -0,0 +1,8 @@
import { UnixDatePipe } from './unix-date.pipe';
describe('UnixDatePipe', () => {
it('create an instance', () => {
const pipe = new UnixDatePipe();
expect(pipe).toBeTruthy();
});
});

View File

@ -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');
}
}

View File

@ -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],
})