From 0209ace221c1f2ba4a0bda096b25bad15573c218 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Mon, 1 May 2023 22:53:33 +0800 Subject: [PATCH] fix: #1154 wrong date range when query usage --- app/requests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/requests.ts b/app/requests.ts index 7e92cc4..9c069cc 100644 --- a/app/requests.ts +++ b/app/requests.ts @@ -102,11 +102,11 @@ export async function requestUsage() { .getDate() .toString() .padStart(2, "0")}`; - const ONE_DAY = 2 * 24 * 60 * 60 * 1000; - const now = new Date(Date.now() + ONE_DAY); + const ONE_DAY = 1 * 24 * 60 * 60 * 1000; + const now = new Date(); const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1); const startDate = formatDate(startOfMonth); - const endDate = formatDate(now); + const endDate = formatDate(new Date(Date.now() + ONE_DAY)); const [used, subs] = await Promise.all([ requestOpenaiClient(