ReviewOS

also looking at this

chris/very-good-adblock

refactor(safari): migrate the safari pipeline to the framework buddy commands

#3
Merged chris wants to merge chore/safari-framework-migration into main
4 files +28 -6
src/shared/metrics.tsmodified+12-0
Changes to src/shared/metrics.ts
@@ -82,6 +82,18 @@ export function compactBuckets(buckets: StatBucket[], limit: number): StatBucket
8282 return [...buckets].sort((a, b) => a.key.localeCompare(b.key)).slice(-limit)
8383}
8484
85/**
86 * YYYY-MM-DD in the user's local timezone. Daily buckets follow the local
87 * calendar so "Blocked today" rolls over at local midnight, and the chart's
88 * day labels (parsed as local dates) match the day the user experienced.
89 */
90export function localDayKey(date: Date = new Date()): string {
91 const year = date.getFullYear()
92 const month = String(date.getMonth() + 1).padStart(2, '0')
93 const day = String(date.getDate()).padStart(2, '0')
94 return `${year}-${month}-${day}`
95}
96
8597export function eventTotals(events: BlockEvent[]): Pick<StatBucket, 'adsBlocked' | 'bytesSaved' | 'videoSecondsSaved'> {
8698 return events.reduce(
8799 (totals, event) => {