From c23bf16eef8a1e3e195f8c7c59d12de142e33fcd Mon Sep 17 00:00:00 2001 From: Jack MB Date: Mon, 16 Sep 2024 13:08:27 +0200 Subject: [PATCH] fix artwork end time --- components/submission/showSubmissionForm.tsx | 1 + pages/api/show-submission-v2.ts | 10 +++++----- types/shared.d.ts | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/submission/showSubmissionForm.tsx b/components/submission/showSubmissionForm.tsx index 5c9ea57..63fdceb 100644 --- a/components/submission/showSubmissionForm.tsx +++ b/components/submission/showSubmissionForm.tsx @@ -113,6 +113,7 @@ export default function ShowSubmissionForm({ number: "", showName: "", datetime: initial ? initial.date : "", + datetimeEnd: initial ? initial.dateEnd : "", length: "1", genres: [], hasNewGenres: false, diff --git a/pages/api/show-submission-v2.ts b/pages/api/show-submission-v2.ts index 9ebd839..370594a 100644 --- a/pages/api/show-submission-v2.ts +++ b/pages/api/show-submission-v2.ts @@ -401,13 +401,13 @@ const socialImage = async (values) => { values.artists.map((x) => x.label).join(", ") ); - // Parse the start time and calculate the end time - const startTime = dayjs(values.datetime).utc(); - const endTime = startTime.add(values.length, "hour"); - // Format the date and time const date = encodeURIComponent( - `${startTime.format("ddd DD MMM / HH:mm")}-${endTime.format("HH:mm")} (CET)` + `${dayjs(values.datetime).utc().format("ddd DD MMM / HH:mm")}-${dayjs( + values.datetimeEnd + ) + .utc() + .format("HH:mm")} (CET)` ); // Determine the base URL based on the environment diff --git a/types/shared.d.ts b/types/shared.d.ts index 6017658..0e32087 100644 --- a/types/shared.d.ts +++ b/types/shared.d.ts @@ -267,6 +267,7 @@ export type SubmissionFormValues = { number: string; showName: string; datetime: string; + datetimeEnd: string; length: string; genres: Array<{ value: string; label: string }>; hasNewGenres: Boolean;