From 0748097a1f916c6dbeeacd35d3412cf364a7347b Mon Sep 17 00:00:00 2001 From: kenobi Date: Wed, 5 Jul 2023 23:21:44 +0200 Subject: [PATCH] refactor datestring function --- server/helper/dateHelper.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/helper/dateHelper.ts b/server/helper/dateHelper.ts index 8fdab45..38c7ca0 100644 --- a/server/helper/dateHelper.ts +++ b/server/helper/dateHelper.ts @@ -4,14 +4,14 @@ import { GuildScheduledEvent } from "discord.js"; import { logger } from "../logger"; import de from "date-fns/locale/de"; -export function createDateStringFromEvent(event: GuildScheduledEvent, requestId: string, guildId?: string): string { - if (!event.scheduledStartAt) { +export function createDateStringFromEvent(eventStartDate:Date, requestId: string, guildId?: string): string { + if (!eventStartDate) { logger.error("Event has no start. Cannot create dateString.", { guildId, requestId }) return `"habe keinen Startzeitpunkt ermitteln können"` } const timeZone = 'Europe/Berlin' - const zonedDateTime = utcToZonedTime(event.scheduledStartAt, timeZone) + const zonedDateTime = utcToZonedTime(eventStartDate, timeZone) const time = format(zonedDateTime, "HH:mm", { locale: de }) if (isToday(zonedDateTime)) {