refactor datestring function
This commit is contained in:
parent
ffba737e5a
commit
0748097a1f
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user