MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getWeekNumber

Function getWeekNumber

scripts/get-changelog.ts:74–88  ·  view source on GitHub ↗
(date: Date)

Source from the content-addressed store, hash-verified

72}
73
74function getWeekNumber(date: Date): number {
75 const d = new Date(date)
76 d.setHours(0, 0, 0, 0)
77 d.setDate(d.getDate() + 3 - ((d.getDay() + 6) % 7))
78 const week1 = new Date(d.getFullYear(), 0, 4)
79 return (
80 1 +
81 Math.round(
82 ((d.getTime() - week1.getTime()) / 86400000 -
83 3 +
84 ((week1.getDay() + 6) % 7)) /
85 7,
86 )
87 )
88}
89
90async function generateChangelog(end: Date) {
91 // Fix: The start should be the beginning of the same week as 'end', not a week before

Callers 1

generateChangelogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected