Skip to content

Commit 5291dfc

Browse files
authored
Display Day 0 if the first day is really short (#2102)
1 parent c9c531c commit 5291dfc

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/app/conf/2025/schedule/_components/format-block-time.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const timeFormat = new Intl.DateTimeFormat(undefined, {
44
hour: "2-digit",
55
minute: "2-digit",
66
})
7+
78
export const formatBlockTime = (start: string, end?: Date) => {
89
const startDate = parseISO(start)
910
if (end) {

src/app/conf/2025/schedule/_components/schedule-list.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ export function ScheduleList({
133133
[filterFields, scheduleData],
134134
)
135135

136+
const firstDay = Object.values(filteredSessions)[0]
137+
// if the first day has less than 3 sessions, it's probably a "day zero" with extra events or workshops
138+
const firstDayIsDayZero = Object.keys(firstDay).length < 3
139+
const startIndex = firstDayIsDayZero ? 0 : 1
140+
136141
return (
137142
<>
138143
<div className="flex justify-between gap-1 max-lg:flex-col">
@@ -171,11 +176,11 @@ export function ScheduleList({
171176
<div className="mb-4 flex space-x-4">
172177
{Object.keys(filteredSessions).map((date, index) => (
173178
<a
174-
href={`#day-${index + 1}`}
179+
href={`#day-${index + startIndex}`}
175180
key={date}
176181
className="typography-link"
177182
>
178-
Day {index + 1}
183+
Day {index + startIndex}
179184
</a>
180185
))}
181186
</div>
@@ -187,7 +192,7 @@ export function ScheduleList({
187192
>
188193
<h3
189194
className="bg-neu-50 py-4 dark:bg-neu-0"
190-
id={`day-${index + 1}`}
195+
id={`day-${index + startIndex}`}
191196
>
192197
{format(parseISO(date), "EEEE, MMMM d")}
193198
</h3>

0 commit comments

Comments
 (0)