consumer模块完成90%,前端完成supabase对接

This commit is contained in:
2026-02-04 17:21:15 +08:00
parent 8a535e3f38
commit 39aa1b6bec
1335 changed files with 191376 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
export type DateRange = { startIso: string; endIso: string }
export function computeDateRange(period: string): DateRange {
const now = new Date()
const start = new Date(now.getTime())
if (period === '7d') start.setDate(start.getDate() - 7)
else if (period === '30d') start.setDate(start.getDate() - 30)
else if (period === '90d') start.setDate(start.getDate() - 90)
else if (period === '1y') start.setFullYear(start.getFullYear() - 1)
return { startIso: start.toISOString(), endIso: now.toISOString() }
}
export function toDateOnly(iso: string): string {
return iso.length >= 10 ? iso.substring(0, 10) : iso
}