Skip to content

Commit

Permalink
fix: date transform fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FairyFromAlfeya committed Sep 19, 2022
1 parent c6b9298 commit 5891d9f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/utils/convert.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@ import { BigNumber } from 'bignumber.js';
const FIXED_POINT_128_MULTIPLIER = new BigNumber(2).pow(128);

export const dateColumnTransformer = {
from: (value: string | null) =>
value ? new Date(value).toISOString() : value,
to: (value: string | null) => (value ? new Date(value).toISOString() : value),
from: (value: any) => {
const type = typeof value;

if (type === 'string' || type === 'number' || value instanceof Date) {
return new Date(value).toISOString();
} else {
return value;
}
},
to: (value: any) => {
const type = typeof value;

if (type === 'string' || type === 'number' || value instanceof Date) {
return new Date(value).toISOString();
} else {
return value;
}
},
};

export const cumulativeToPrice = (cumulative: string, scale: number): string =>
Expand Down

0 comments on commit 5891d9f

Please sign in to comment.