Skip to content

Commit

Permalink
Remove unused transaction helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchung committed Oct 26, 2023
1 parent 4f93bf9 commit 00331bb
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/helpers/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { format } from 'date-fns';
import {
TransactionStatus,
TransactionStatusTypes,
TransactionType,
TransactionTypes,
} from '@/entities';
import { getDateFnsLocale } from '@/languages';

export const buildTransactionUniqueIdentifier = ({
hash,
displayDetails,
}: any) => hash || displayDetails?.timestampInMs;

export const calculateTimestampOfToday = () => {
const d = new Date();
Expand Down Expand Up @@ -45,37 +37,6 @@ export const yesterdayTimestamp = calculateTimestampOfYesterday();
export const thisMonthTimestamp = calculateTimestampOfThisMonth();
export const thisYearTimestamp = calculateTimestampOfThisYear();

export function getHumanReadableDate(date: any) {
const timestamp = new Date(date * 1000);

// i18n
return format(
timestamp,
// @ts-expect-error ts-migrate(2365) FIXME: Operator '>' cannot be applied to types 'Date' and... Remove this comment to see the full error message
timestamp > todayTimestamp
? `'Today'`
: // @ts-expect-error ts-migrate(2365) FIXME: Operator '>' cannot be applied to types 'Date' and... Remove this comment to see the full error message
timestamp > yesterdayTimestamp
? `'Yesterday'`
: // @ts-expect-error ts-migrate(2365) FIXME: Operator '>' cannot be applied to types 'Date' and... Remove this comment to see the full error message
`'on' MMM d${timestamp > thisYearTimestamp ? '' : ' yyyy'}`,
{ locale: getDateFnsLocale() }
);
}

export function hasAddableContact(status: any, type: any) {
if (
(status === TransactionStatusTypes.received &&
type !== TransactionTypes.trade) ||
status === TransactionStatusTypes.receiving ||
status === TransactionStatusTypes.sending ||
status === TransactionStatusTypes.sent
) {
return true;
}
return false;
}

/**
* Returns the `TransactionStatus` that represents completion for a given
* transaction type.
Expand Down

0 comments on commit 00331bb

Please sign in to comment.