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

Function getDurationFor

packages/shared/src/features/feedExplain/duration.ts:21–32  ·  view source on GitHub ↗
(
  expiresAt: string | null | undefined,
  now = Date.now(),
)

Source from the content-addressed store, hash-verified

19
20/** The picker's choice for a change that is already running. */
21export const getDurationFor = (
22 expiresAt: string | null | undefined,
23 now = Date.now(),
24): FeedControlDuration | undefined => {
25 if (!expiresAt) {
26 return undefined;
27 }
28 return new Date(expiresAt).getTime() <=
29 now + durationDays[FeedControlDuration.ThreeDays] * dayMs
30 ? FeedControlDuration.ThreeDays
31 : FeedControlDuration.Week;
32};
33
34// The API sets the real one; this is for the change shown before it answers.
35export const getExpiresAt = (

Callers 1

LevelPickerFunction · 0.90

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected