mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-23 12:11:16 +00:00
refactor(@cockpit/ui/utils): adjust date-fns imports/usage re: changes in 2.x
This commit is contained in:
parent
ec4e3cd9d0
commit
166f339a03
@ -1,5 +1,5 @@
|
||||
import isToday from 'date-fns/is_today';
|
||||
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
|
||||
import isToday from 'date-fns/isToday';
|
||||
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
||||
|
||||
export function formatContractForDisplay(contract) {
|
||||
let address = (contract.deployedAddress || contract.deployedAddress);
|
||||
@ -23,7 +23,7 @@ export function formatContractForDisplay(contract) {
|
||||
|
||||
export function formatTimestampForDisplay(timestamp) {
|
||||
if (isToday(new Date(timestamp * 1000))) {
|
||||
return distanceInWordsToNow(new Date(timestamp * 1000), {addSuffix: true});
|
||||
return formatDistanceToNow(new Date(timestamp * 1000), {addSuffix: true});
|
||||
}
|
||||
return new Date(timestamp * 1000).toLocaleString();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user