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

Function formatUntil

packages/shared/src/features/feedExplain/duration.ts:44–53  ·  view source on GitHub ↗
(expiresAt: string, now = Date.now())

Source from the content-addressed store, hash-verified

42
43/** "until Sun", or "until Thu, Oct 22" when the weekday alone is ambiguous. */
44export const formatUntil = (expiresAt: string, now = Date.now()): string => {
45 const until = new Date(expiresAt);
46 const weekday = until.toLocaleDateString('en-US', { weekday: 'short' });
47 return until.getTime() - now < 6 * dayMs
48 ? `until ${weekday}`
49 : `until ${weekday}, ${until.toLocaleDateString('en-US', {
50 month: 'short',
51 day: 'numeric',
52 })}`;
53};

Callers 2

getControlMetaFunction · 0.90
LevelPickerFunction · 0.90

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected