From 07c002026b8b2991bea321c4f9da7d9151bc6968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Sat, 11 Jan 2025 22:00:31 +0500 Subject: [PATCH] Fix dates. --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index b62ad7c..c74353e 100644 --- a/index.ts +++ b/index.ts @@ -14,7 +14,7 @@ const ip = process.argv[2]; const port = Number(process.argv[3]); function msgToString(time: Date, address: string, msg: string) { - return "[" + time.getDate() + "." + (time.getMonth() + 1) + "." + time.getFullYear() + + return "[" + String(time.getDate()).padStart(2, '0') + "." + String(time.getMonth() + 1).padStart(2, '0') + "." + time.getFullYear() + " " + String(time.getHours()).padStart(2, '0') + ":" + String(time.getMinutes()).padStart(2, '0') + "] {" + address + "} " + msg;