Fix agenda header formatting.

master
Tom Hacohen 7 years ago
parent 86c5a822cb
commit c73aabf0cc

@ -43,6 +43,11 @@ class Calendar extends React.Component {
}; };
} }
function agendaHeaderFormat(date: {start: Date, end: Date}, culture: string, localizer: any) {
const format = 'll';
return localizer.format(date.start, format) + ' - ' + localizer.format(date.end, format);
}
return ( return (
<div style={{width: '100%', height: 500, padding: 10}}> <div style={{width: '100%', height: 500, padding: 10}}>
<BigCalendar <BigCalendar
@ -50,6 +55,7 @@ class Calendar extends React.Component {
onSelectEvent={(event: any) => { onSelectEvent={(event: any) => {
this.props.onItemClick(event); this.props.onItemClick(event);
}} }}
formats={{agendaHeaderFormat: agendaHeaderFormat}}
eventPropGetter={eventPropGetter} eventPropGetter={eventPropGetter}
date={this.state.currentDate} date={this.state.currentDate}
onNavigate={(currentDate: Date) => { this.setState({currentDate}); }} onNavigate={(currentDate: Date) => { this.setState({currentDate}); }}

Loading…
Cancel
Save