From afd8d1f68a8dbd4786aad2c847dc92c73f8eb409 Mon Sep 17 00:00:00 2001 From: CL TheDreWen Date: Mon, 3 Nov 2025 14:35:06 +0100 Subject: [PATCH] fix(status): integrate dayjs for formatted timestamps in notifications --- package-lock.json | 7 ++++--- package.json | 1 + src/services/status.service.ts | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index c63a218..56ed9e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@types/ping": "^0.4.4", "cron": "^4.3.3", + "dayjs": "^1.11.19", "discord.js": "^14.24.2", "dotenv": "^17.2.2", "pg": "^8.16.3", @@ -552,9 +553,9 @@ } }, "node_modules/dayjs": { - "version": "1.11.18", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.18.tgz", - "integrity": "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA==", + "version": "1.11.19", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz", + "integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==", "license": "MIT" }, "node_modules/debug": { diff --git a/package.json b/package.json index ca44238..0091ccb 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "dependencies": { "@types/ping": "^0.4.4", "cron": "^4.3.3", + "dayjs": "^1.11.19", "discord.js": "^14.24.2", "dotenv": "^17.2.2", "pg": "^8.16.3", diff --git a/src/services/status.service.ts b/src/services/status.service.ts index 7670b44..b05b7b3 100644 --- a/src/services/status.service.ts +++ b/src/services/status.service.ts @@ -7,6 +7,7 @@ import { HostsLog } from "../entity/hostslog.entity"; import { Repository } from "typeorm"; import { Follow } from "../entity/follow.entity"; import { Guild } from "../entity/guild.entity"; +import dayjs from "dayjs"; type Nofity = {time: Date, name : string, alive : boolean, type : InfraType, host: string}; @@ -302,9 +303,8 @@ export class StatusService { ) ) }); - - const now = new Date(); - container.addTextDisplayComponents((text) => text.setContent(`${live ? 'Last update : ' : ''}${now.getDate()}-${now.getMonth() + 1}-${now.getFullYear()} ${(now.getHours() + '').padStart(2, "0")}:${(now.getMinutes() + '').padStart(2, "0")} - Receive automatic notifications when there is an outage with /follow !`)); + + container.addTextDisplayComponents((text) => text.setContent(`${live ? 'Last update : ' : ''} - Receive automatic notifications when there is an outage with /follow !`)); return container; }