mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Return an empty string when date is not provided [Date display utils] (#11831)
This commit is contained in:
parent
f5f923d208
commit
b7bab56a04
@ -16,6 +16,9 @@ import { toChecksumHexAddress } from '../../../shared/modules/hexstring-utils';
|
||||
|
||||
// formatData :: ( date: <Unix Timestamp> ) -> String
|
||||
export function formatDate(date, format = "M/d/y 'at' T") {
|
||||
if (!date) {
|
||||
return '';
|
||||
}
|
||||
return DateTime.fromMillis(date).toFormat(format);
|
||||
}
|
||||
|
||||
@ -24,6 +27,9 @@ export function formatDateWithYearContext(
|
||||
formatThisYear = 'MMM d',
|
||||
fallback = 'MMM d, y',
|
||||
) {
|
||||
if (!date) {
|
||||
return '';
|
||||
}
|
||||
const dateTime = DateTime.fromMillis(date);
|
||||
const now = DateTime.local();
|
||||
return dateTime.toFormat(
|
||||
|
@ -80,7 +80,7 @@ export function useTransactionDisplayData(transactionGroup) {
|
||||
|
||||
const primaryValue = primaryTransaction.txParams?.value;
|
||||
let prefix = '-';
|
||||
const date = formatDateWithYearContext(initialTransaction.time || 0);
|
||||
const date = formatDateWithYearContext(initialTransaction.time);
|
||||
let subtitle;
|
||||
let subtitleContainsOrigin = false;
|
||||
let recipientAddress = to;
|
||||
|
Loading…
Reference in New Issue
Block a user