MCPcopy
hub / github.com/BlueWallet/BlueWallet / transactionTimeToReadable

Function transactionTimeToReadable

loc/index.ts:322–342  ·  view source on GitHub ↗
(time: number | string)

Source from the content-addressed store, hash-verified

320};
321
322export const transactionTimeToReadable = (time: number | string) => {
323 if (time === -1) {
324 return 'unknown';
325 }
326 if (+time < 1000000000000) {
327 // converting timestamp to milliseconds timestamp
328 // (we dont expect timestamps before September 9, 2001 so this conversion is fine)
329 time = +time * 1000;
330 }
331 if (time === 0) {
332 return loc._.never;
333 }
334 let ret;
335 try {
336 ret = dayjs(time).fromNow();
337 } catch (_) {
338 console.warn('incorrect locale set for dayjs');
339 return String(time);
340 }
341 return ret;
342};
343
344const ONE_DAY_MS = 24 * 60 * 60 * 1000;
345

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected