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

Function canBumpStreak

packages/shared/src/hooks/post/useViewPost.ts:24–31  ·  view source on GitHub ↗
(
  streak: UserStreak,
  timezone?: string,
  now: Date = new Date(),
)

Source from the content-addressed store, hash-verified

22
23// After a longer gap the API decides (off days, freezes, a reset)
24const canBumpStreak = (
25 streak: UserStreak,
26 timezone?: string,
27 now: Date = new Date(),
28): boolean =>
29 !streak.lastViewAt ||
30 streak.current === 0 ||
31 isSameDayInTimezone(new Date(streak.lastViewAt), subDays(now, 1), timezone);
32
33const wait = (ms: number) =>
34 new Promise<void>((resolve) => {

Callers 1

useViewPostFunction · 0.85

Calls 1

isSameDayInTimezoneFunction · 0.90

Tested by

no test coverage detected