MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / mondayOfISOWeek

Function mondayOfISOWeek

packages/app-core/src/lib/template-render.ts:137–143  ·  view source on GitHub ↗
(weekYear: number, week: number)

Source from the content-addressed store, hash-verified

135 * its Monday and step forward whole weeks.
136 */
137export function mondayOfISOWeek(weekYear: number, week: number): Date {
138 const jan4 = new Date(Date.UTC(weekYear, 0, 4))
139 const dayNum = jan4.getUTCDay() || 7 // Sunday -> 7
140 const monday = new Date(jan4)
141 monday.setUTCDate(jan4.getUTCDate() - (dayNum - 1) + (week - 1) * 7)
142 return new Date(monday.getUTCFullYear(), monday.getUTCMonth(), monday.getUTCDate())
143}
144
145function substituteTokens(input: string, title: string, now: Date): string {
146 return input.replace(TOKEN_RE, (full, rawToken: string) => {

Callers 2

weeklyCandidateMondaysFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected