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

Function getCurrentWeekStart

packages/shared/src/lib/picks.ts:18–27  ·  view source on GitHub ↗
(now: Date = new Date())

Source from the content-addressed store, hash-verified

16
17/** This ISO week's Monday as YYYY-MM-DD in UTC, the way the API keys picks. */
18export const getCurrentWeekStart = (now: Date = new Date()): string => {
19 const today = Date.UTC(
20 now.getUTCFullYear(),
21 now.getUTCMonth(),
22 now.getUTCDate(),
23 );
24 const daysSinceMonday = (new Date(today).getUTCDay() + 6) % 7;
25
26 return new Date(today - daysSinceMonday * DAY_MS).toISOString().slice(0, 10);
27};
28
29/**
30 * Distinct posts of the week below which there is nothing worth nudging

Callers 7

seedSnapshotFunction · 0.90
picks.spec.tsFile · 0.90
useWeeklyPicksHeroFunction · 0.90
PicksPageFunction · 0.90
PicksPage.spec.tsxFile · 0.90

Calls

no outgoing calls

Tested by 1

seedSnapshotFunction · 0.72