Schedule: let the built-in agenda (withAgenda) use a custom time format or renderEvent #9356
TMShumway
started this conversation in
Feature requests
Replies: 1 comment
|
Thanks for the detailed request! This is implemented and will be available in the next patch release. A new import dayjs from 'dayjs';
import { AgendaView, DayView, Schedule } from '@mantine/schedule';
// Schedule: agenda of day/week/month views and MobileMonthView in responsive layout
<Schedule events={events} withAgenda layout="responsive" eventTimeFormat="h:mm A" />;
// Individual views
<DayView date={date} events={events} withAgenda eventTimeFormat="h:mm A" />;
// Standalone AgendaView
<AgendaView rangeStart="2025-11-01" rangeEnd="2025-11-30" events={events} eventTimeFormat="h:mm A" />;
// Function format, receives the date as a 'YYYY-MM-DD HH:mm:ss' string
<Schedule
events={events}
withAgenda
eventTimeFormat={(date) => dayjs(date).format(dayjs(date).minute() === 0 ? 'h A' : 'h:mm A')}
/>; |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
With
withAgenda,DayView,WeekViewandMonthViewrender their ownAgendaView, and pass it onlyrangeStart,rangeEnd,events,locale,labels,mode,onEventClick,recurrenceExpansionLimitand the Styles API props (checked in 9.7.4).Inside
AgendaViewthe event time is fixed:dayjs(event.start).format("HH:mm"). An app that shows 12-hour times everywhere else can't make the agenda match. The standaloneAgendaViewacceptsrenderEvent, but the views don't forward it to the agenda they mount.Either of these would solve it:
AgendaView(for exampleeventTimeFormat, in the spirit ofslotLabelFormat), settable fromScheduleand the views and forwarded to the built-in agenda.renderEvent, or anagendaViewPropsobject likeSchedule'sdayViewProps, from the views to the agenda they render.All reactions