(now = nowMs(), tzOffsetMinutes = 480)
| 19 | } |
| 20 | |
| 21 | export function localDayString(now = nowMs(), tzOffsetMinutes = 480): string { |
| 22 | const offsetMs = tzOffsetMinutes * 60 * 1000; |
| 23 | const local = new Date(now + offsetMs); |
| 24 | const y = local.getUTCFullYear(); |
| 25 | const m = local.getUTCMonth() + 1; |
| 26 | const d = local.getUTCDate(); |
| 27 | return `${y}-${pad2(m)}-${pad2(d)}`; |
| 28 | } |
| 29 | |
| 30 | export async function listUsageForDay(db: Env["DB"], day: string): Promise<ApiKeyUsageRow[]> { |
| 31 | return dbAll<ApiKeyUsageRow>( |
no test coverage detected