MCPcopy Create free account
hub / github.com/anomalyco/opencode / getWeekBounds

Function getWeekBounds

packages/console/core/src/util/date.ts:1–9  ·  view source on GitHub ↗
(date: Date)

Source from the content-addressed store, hash-verified

1export function getWeekBounds(date: Date) {
2 const offset = (date.getUTCDay() + 6) % 7
3 const start = new Date(date)
4 start.setUTCDate(date.getUTCDate() - offset)
5 start.setUTCHours(0, 0, 0, 0)
6 const end = new Date(start)
7 end.setUTCDate(start.getUTCDate() + 7)
8 return { start, end }
9}
10
11export function getMonthlyBounds(now: Date, subscribed: Date) {
12 const day = subscribed.getUTCDate()

Callers 5

date.test.tsFile · 0.90
subscription.tsFile · 0.90
getSubscriptionStatusFunction · 0.85
trackUsageFunction · 0.85
getSubscriptionStatusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected