MCPcopy Create free account
hub / github.com/dailydotdev/apps / formatEndsIn

Function formatEndsIn

packages/shared/src/features/liveChat/timeLeft.ts:30–43  ·  view source on GitHub ↗
(
  expiresAt?: string | null,
  now: number = Date.now(),
)

Source from the content-addressed store, hash-verified

28
29// "ends in 45m", or nothing while the room has hours ahead of it.
30export const formatEndsIn = (
31 expiresAt?: string | null,
32 now: number = Date.now(),
33): string | undefined => {
34 if (!expiresAt) {
35 return undefined;
36 }
37 const left = new Date(expiresAt).getTime() - now;
38 if (left > LIVE_CHAT_ENDS_SOON_MS) {
39 return undefined;
40 }
41
42 return `ends in ${formatTimeLeft(expiresAt, now)}`;
43};

Callers 5

RoomRowFunction · 0.90
timeLeft.spec.tsFile · 0.90
LiveChatHighlightRowFunction · 0.90
LiveChatPanelFunction · 0.90
TopicChatScreenFunction · 0.90

Calls 2

nowMethod · 0.80
formatTimeLeftFunction · 0.70

Tested by

no test coverage detected