Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React big calendar hide start time end time from time slot

I have a react big calendar as in teh picture below, and I want to remove the circled strat-time/end time:

img

The react big calendare is rendered with this parameters:

<BigCalendar
                selectable
                events={this.props.events?this.props.events:[]}
                views={{ week:MyWeek}}
                defaultView='week'
                defaultDate={this.state.date?this.state.date:new Date()}
                date={this.state.date?this.state.date:new Date()}
                now={new Date(0)}
                min={new Date(this.state.today.getFullYear(), this.state.today.getMonth(), this.state.today.getDate(), 8)}
                max={new Date(this.state.today.getFullYear(), this.state.today.getMonth(), this.state.today.getDate(), 20)}
                onSelectSlot={(slotInfo) => {this.props.onSelectSlot('interview', slotInfo, 'add'); store.dispatch(addBreadcrumb({name: B_PREPARATION_INTERVIEW}));}}
                onSelectEvent={event => {this.props.onSelectEvent('interview', event); store.dispatch(addBreadcrumb({name: B_PREPARATION_INTERVIEW}));} }
                onNavigate={(date) => this.changeDate(date)}
                components={{event: Event }}
                eventPropGetter={(this.eventStyleGetter)}
                titleAccessor={function(e) {console.log("aaaaaaaaaaa"); console.log(e); return e.title;}}
            />

I tried to add titleAccessor to remove the start time/end time but with no result.

like image 854
georgiana_e Avatar asked Nov 06 '25 00:11

georgiana_e


2 Answers

You can override the CSS class rbc-event-label like so:

.rbc-event-label {
  display: none;
}

to hide the start and end times.

like image 189
Erich Schreiner Avatar answered Nov 07 '25 14:11

Erich Schreiner


Following the formats section in the documentation:

const formats = {
    eventTimeRangeFormat: () => { 
      return "";
    },
  };
<Calendar formats={formats} />
like image 36
gbread Avatar answered Nov 07 '25 14:11

gbread



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!