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;