You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
427 B
TypeScript
9 lines
427 B
TypeScript
import { formatDistanceToNow, subMilliseconds } from 'date-fns';
|
|
import { GetNetworkTime } from '../session/apis/snode_api/getNetworkTime';
|
|
|
|
export const formatDateDistanceWithOffset = (date: Date): string => {
|
|
const locale = (window.i18n as any).getLocale();
|
|
const adjustedDate = subMilliseconds(date, GetNetworkTime.getLatestTimestampOffset());
|
|
return formatDistanceToNow(adjustedDate, { addSuffix: true, locale });
|
|
};
|