Compare commits
2 commits
f752a48e5a
...
c185e4423a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c185e4423a | ||
|
|
1f3609fbad |
4 changed files with 23 additions and 5 deletions
|
|
@ -55,7 +55,6 @@ export default async function GroupPage({ params }: { params: Promise<{slug: str
|
|||
|
||||
}
|
||||
|
||||
|
||||
<Section paddingBottom={"small"}>
|
||||
<Container>
|
||||
<Row>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
}
|
||||
|
||||
.col {
|
||||
flex: 1 1 0;
|
||||
flex: 1 1 40%;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
|
|
|
|||
|
|
@ -77,6 +77,14 @@ export const WithPhoto: Story = {
|
|||
}
|
||||
}
|
||||
|
||||
export const WithEndDateOnDifferentDay: Story = {
|
||||
args: {
|
||||
...Default.args,
|
||||
date: "2024-12-02T13:00:00Z",
|
||||
endDateTime: "2024-12-04T14:00:00Z",
|
||||
},
|
||||
}
|
||||
|
||||
export const WithOccurrences: Story = {
|
||||
args: {
|
||||
...Default.args,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
/**
|
||||
* Return a readable date time
|
||||
* e.G. Samstag 13-01-2024, 12:00 Uhr
|
||||
* With endDate: Samstag 13-01-2024, 12:00 Uhr bis 14:00 Uhr
|
||||
* With endDate (same day): Samstag 13-01-2024, 12:00 Uhr bis 14:00 Uhr
|
||||
* With endDate (other day): Samstag 13-01-2024, 12:00 Uhr bis 15-01-2024, 14:00 Uhr
|
||||
*/
|
||||
export const readableDateTime = (date: string, endDate?: string | null) => {
|
||||
const dateObj = new Date(date);
|
||||
|
|
@ -10,6 +11,16 @@ export const readableDateTime = (date: string, endDate?: string | null) => {
|
|||
const time = dateObj.toLocaleTimeString("de-DE", { timeStyle: "short", timeZone: "Europe/Berlin" });
|
||||
const base = `${dayName} ${normalDate}, ${time} Uhr`;
|
||||
if (!endDate) return base;
|
||||
const endTime = new Date(endDate).toLocaleTimeString("de-DE", { timeStyle: "short", timeZone: "Europe/Berlin" });
|
||||
return `${base} bis ${endTime} Uhr`;
|
||||
|
||||
const endObj = new Date(endDate);
|
||||
const endTime = endObj.toLocaleTimeString("de-DE", { timeStyle: "short", timeZone: "Europe/Berlin" });
|
||||
|
||||
const isSameDay =
|
||||
dateObj.toLocaleDateString("de-DE", { timeZone: "Europe/Berlin" }) ===
|
||||
endObj.toLocaleDateString("de-DE", { timeZone: "Europe/Berlin" });
|
||||
|
||||
if (isSameDay) return `${base} bis ${endTime} Uhr`;
|
||||
|
||||
const endNormalDate = endObj.toLocaleDateString("de-DE", { dateStyle: "medium" });
|
||||
return `${base} bis ${endNormalDate}, ${endTime} Uhr`;
|
||||
}
|
||||
Loading…
Reference in a new issue