From a24135162557983883663ca04a52635c8547d75e Mon Sep 17 00:00:00 2001 From: Sangjin Yoon Date: Thu, 28 Nov 2024 16:36:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=82=A0=EC=A7=9C=20=ED=98=95=EC=8B=9D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../name-server/src/database/query/dau-recorder.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/name-server/src/database/query/dau-recorder.ts b/backend/name-server/src/database/query/dau-recorder.ts index f8291ffa..17003289 100644 --- a/backend/name-server/src/database/query/dau-recorder.ts +++ b/backend/name-server/src/database/query/dau-recorder.ts @@ -8,8 +8,9 @@ export class DAURecorder implements DAURecorderInterface { private clickhouseClient = ClickhouseDatabase.getInstance(); public async recordAccess(domain: string): Promise { - const dateString = new Date().toLocaleDateString(); - const values = [{ domain: domain.toLowerCase(), date: dateString, access: 1 }]; + const values = [ + { domain: domain.toLowerCase(), date: this.formatDate(new Date()), access: 1 }, + ]; try { await this.clickhouseClient.insert({ table: 'dau', @@ -20,4 +21,12 @@ export class DAURecorder implements DAURecorderInterface { console.error('ClickHouse Error:', error); } } + + private formatDate(date: Date): string { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + + return `${year}-${month}-${day}`; + } }