From 0872a9ffe2ca3c263f4caa6592d236303422fa9a Mon Sep 17 00:00:00 2001 From: belopash Date: Thu, 16 May 2024 13:56:57 +0500 Subject: [PATCH] fix: display vesting end and start as dates --- src/api/contracts/vesting.ts | 4 ++-- src/pages/AssetsPage/Vesting.tsx | 5 +++-- src/pages/GatewaysPage/GatewaysPage.tsx | 2 +- src/pages/WorkersPage/WorkerStatistics.tsx | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/api/contracts/vesting.ts b/src/api/contracts/vesting.ts index 1614cfa..c5d58f1 100644 --- a/src/api/contracts/vesting.ts +++ b/src/api/contracts/vesting.ts @@ -64,8 +64,8 @@ export function useVestings({ addresses }: { addresses?: `0x${string}`[] }) { return { data: data ? chunk(data, 8).map(ch => ({ - start: unwrapResult(ch[0])?.toString(), - end: unwrapResult(ch[1])?.toString(), + start: Number(unwrapResult(ch[0])) * 1000, + end: Number(unwrapResult(ch[1])) * 1000, deposited: unwrapResult(ch[2])?.toString(), releasable: unwrapResult(ch[3])?.toString(), released: unwrapResult(ch[4])?.toString(), diff --git a/src/pages/AssetsPage/Vesting.tsx b/src/pages/AssetsPage/Vesting.tsx index 894d88b..031f371 100644 --- a/src/pages/AssetsPage/Vesting.tsx +++ b/src/pages/AssetsPage/Vesting.tsx @@ -1,5 +1,6 @@ import React from 'react'; +import { dateFormat } from '@i18n'; import { addressFormatter, percentFormatter } from '@lib/formatters/formatters'; import { Divider, Stack, styled } from '@mui/material'; import { Box } from '@mui/system'; @@ -104,11 +105,11 @@ export function Vesting({ backPath }: { backPath: string }) { Start - {data.start || '-'} + {dateFormat(data.start, 'dateTime')} End - {data.end || '-'} + {dateFormat(data.end, 'dateTime')} Initial release diff --git a/src/pages/GatewaysPage/GatewaysPage.tsx b/src/pages/GatewaysPage/GatewaysPage.tsx index 5938b98..edb7754 100644 --- a/src/pages/GatewaysPage/GatewaysPage.tsx +++ b/src/pages/GatewaysPage/GatewaysPage.tsx @@ -56,7 +56,7 @@ export function MyGateways() { {formatSqd(SQD_TOKEN, gateway.pendingStaked)} {formatSqd(SQD_TOKEN, gateway.totalStaked)} - {dateFormat(gateway.createdAt)} + {dateFormat(gateway.createdAt, 'dateTime')} ); })} diff --git a/src/pages/WorkersPage/WorkerStatistics.tsx b/src/pages/WorkersPage/WorkerStatistics.tsx index a8759d6..de14087 100644 --- a/src/pages/WorkersPage/WorkerStatistics.tsx +++ b/src/pages/WorkersPage/WorkerStatistics.tsx @@ -70,7 +70,7 @@ export const WorkerStatistics = ({ worker }: { worker: BlockchainApiFullWorker } Registered - {dateFormat(worker.createdAt)} + {dateFormat(worker.createdAt, 'dateTime')} Version