Reputation: 607
I'm using this setup for react big calendar:
render() {
return (
<div>
<BigCalendar
selectable
step={3}
timeslots={10}
events={eventsE}
defaultView='week'
onSelectEvent={event => this.onSelectEventDate(event)}
onSelectSlot={(slotInfo) => this.onSelectSlotDate(slotInfo) }
/>
</div>
);
I'm using this plugin http://intljusticemission.github.io/react-big-calendar/examples/index.html
But the start time is always at 12AM How can i change to start only at 8AM...and do not waste time slots.
Thanks in advance Carlos Vieira
Upvotes: 6
Views: 8892
Reputation: 225
You have to set today date in state and after use.
// For react-big-calendar: "^0.27.0",
// declare 'today' inside your component
const today = new Date();
// start time 8:00am
min={
new Date(
today.getFullYear(),
today.getMonth(),
today.getDate(),
8
)
}
// end time 5:00pm
max={
new Date(
today.getFullYear(),
today.getMonth(),
today.getDate(),
17
)
}
Upvotes: 17
Reputation: 419
You need to set the 'date' prop to your request date:
render() {
return (
<div>
<BigCalendar
selectable
step={3}
date={new Date(Date.now())}
timeslots={10}
events={eventsE}
defaultView='week'
onSelectEvent={event => this.onSelectEventDate(event)}
onSelectSlot={(slotInfo) => this.onSelectSlotDate(slotInfo) }
/>
</div>
);
anther prop you can use is 'defaultDate'.
Upvotes: 0