MCPcopy Create free account
hub / github.com/TQZHR/grok2api / localDayString

Function localDayString

src/repo/apiKeyUsage.ts:21–28  ·  view source on GitHub ↗
(now = nowMs(), tzOffsetMinutes = 480)

Source from the content-addressed store, hash-verified

19}
20
21export 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
30export async function listUsageForDay(db: Env["DB"], day: string): Promise<ApiKeyUsageRow[]> {
31 return dbAll<ApiKeyUsageRow>(

Callers 2

enforceQuotaFunction · 0.90
admin.tsFile · 0.90

Calls 2

nowMsFunction · 0.90
pad2Function · 0.85

Tested by

no test coverage detected