chore: rename fromISONano to be more explicit

This commit is contained in:
Matthew Russell 2023-02-06 15:36:16 -08:00
parent eef562762a
commit 58d0174934
No known key found for this signature in database
GPG Key ID: EF695622F2C5E3D8
4 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
import {
addDecimal,
fromISONanoSeconds,
fromISONano,
t,
useThemeSwitcher,
} from '@vegaprotocol/react-helpers';
@ -228,7 +228,7 @@ export const AccountHistoryChart = ({
.reduce((acc, edge) => {
if (edge.node.accountType === accountType) {
acc?.push({
datetime: fromISONanoSeconds(edge.node.timestamp),
datetime: fromISONano(edge.node.timestamp),
balance: Number(addDecimal(edge.node.balance, asset.decimals)),
});
}

View File

@ -1,7 +1,7 @@
import { useMemo } from 'react';
import { useStatisticsQuery } from '../utils/__generated__/Node';
import { useHeaderStore } from '@vegaprotocol/apollo-client';
import { fromISONanoSeconds } from '@vegaprotocol/react-helpers';
import { fromISONano } from '@vegaprotocol/react-helpers';
import { useEnvironment } from './use-environment';
export const useNodeHealth = () => {
@ -27,7 +27,7 @@ export const useNodeHealth = () => {
return {
coreBlockHeight: Number(data?.statistics.blockHeight || 0),
coreVegaTime: fromISONanoSeconds(data?.statistics.vegaTime),
coreVegaTime: fromISONano(data?.statistics.vegaTime),
datanodeBlockHeight: headers?.blockHeight,
datanodeVegaTime: headers?.timestamp,
blockDiff,

View File

@ -1,7 +1,7 @@
import {
addDecimalsFormatNumber,
DateRangeFilter,
fromISONanoSeconds,
fromISONano,
getDateTimeFormat,
SetFilter,
t,
@ -199,7 +199,7 @@ export const LedgerTable = forwardRef<AgGridReact, LedgerEntryProps>(
valueFormatter={({
value,
}: VegaValueFormatterParams<LedgerEntry, 'vegaTime'>) =>
value ? getDateTimeFormat().format(fromISONanoSeconds(value)) : '-'
value ? getDateTimeFormat().format(fromISONano(value)) : '-'
}
filter={DateRangeFilter}
/>

View File

@ -4,7 +4,7 @@ export const toNanoSeconds = (date: Date | string) => {
return new Date(date).getTime().toString() + '000000';
};
export const fromISONanoSeconds = (ts: string) => {
export const fromISONano = (ts: string) => {
const val = parseISO(ts);
return new Date(isValid(val) ? val : 0);
};