Compare commits
No commits in common. "c185e4423a1ccd58b52d70a41dd51b2c067c9bd7" and "f752a48e5afd9973169130878b0bae104f781418" have entirely different histories.
c185e4423a
...
f752a48e5a
4 changed files with 5 additions and 23 deletions
|
|
@ -55,6 +55,7 @@ export default async function GroupPage({ params }: { params: Promise<{slug: str
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<Section paddingBottom={"small"}>
|
<Section paddingBottom={"small"}>
|
||||||
<Container>
|
<Container>
|
||||||
<Row>
|
<Row>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.col {
|
.col {
|
||||||
flex: 1 1 40%;
|
flex: 1 1 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1024px) {
|
@media screen and (max-width: 1024px) {
|
||||||
|
|
|
||||||
|
|
@ -77,14 +77,6 @@ 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 = {
|
export const WithOccurrences: Story = {
|
||||||
args: {
|
args: {
|
||||||
...Default.args,
|
...Default.args,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Return a readable date time
|
* Return a readable date time
|
||||||
* e.G. Samstag 13-01-2024, 12:00 Uhr
|
* e.G. Samstag 13-01-2024, 12:00 Uhr
|
||||||
* With endDate (same day): Samstag 13-01-2024, 12:00 Uhr bis 14:00 Uhr
|
* With endDate: 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) => {
|
export const readableDateTime = (date: string, endDate?: string | null) => {
|
||||||
const dateObj = new Date(date);
|
const dateObj = new Date(date);
|
||||||
|
|
@ -11,16 +10,6 @@ export const readableDateTime = (date: string, endDate?: string | null) => {
|
||||||
const time = dateObj.toLocaleTimeString("de-DE", { timeStyle: "short", timeZone: "Europe/Berlin" });
|
const time = dateObj.toLocaleTimeString("de-DE", { timeStyle: "short", timeZone: "Europe/Berlin" });
|
||||||
const base = `${dayName} ${normalDate}, ${time} Uhr`;
|
const base = `${dayName} ${normalDate}, ${time} Uhr`;
|
||||||
if (!endDate) return base;
|
if (!endDate) return base;
|
||||||
|
const endTime = new Date(endDate).toLocaleTimeString("de-DE", { timeStyle: "short", timeZone: "Europe/Berlin" });
|
||||||
const endObj = new Date(endDate);
|
return `${base} bis ${endTime} Uhr`;
|
||||||
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