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

Function isAway

packages/shared/src/features/patchy/patchyTriggers.ts:56–70  ·  view source on GitHub ↗
(
  lastViewAt: Date | string | undefined | null,
  hasReadToday: boolean,
  now: Date,
  awayMs: number,
)

Source from the content-addressed store, hash-verified

54
55// Away = the last counted read is older than `awayMs` and nothing today yet.
56export const isAway = (
57 lastViewAt: Date | string | undefined | null,
58 hasReadToday: boolean,
59 now: Date,
60 awayMs: number,
61): boolean => {
62 if (!lastViewAt || hasReadToday) {
63 return false;
64 }
65 const last = new Date(lastViewAt).getTime();
66 if (Number.isNaN(last)) {
67 return false;
68 }
69 return now.getTime() - last >= awayMs;
70};
71
72interface PatchyMoodInput {
73 state: StreakRingState;

Callers 4

usePatchyAssistantFunction · 0.90
usePatchyCompanionFunction · 0.90
getPatchyMoodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected