mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-15 10:00:28 +00:00
9 lines
295 B
TypeScript
9 lines
295 B
TypeScript
export function getWeekBounds(date: Date) {
|
|
const offset = (date.getUTCDay() + 6) % 7
|
|
const start = new Date(date)
|
|
start.setUTCDate(date.getUTCDate() - offset)
|
|
start.setUTCHours(0, 0, 0, 0)
|
|
const end = new Date(start)
|
|
end.setUTCDate(start.getUTCDate() + 7)
|
|
return { start, end }
|
|
}
|