Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

start time big calendar react

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

like image 561
Carlos Vieira Avatar asked Mar 10 '23 15:03

Carlos Vieira


1 Answers

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
     )
   }
like image 129
Florent Giraud Avatar answered Mar 20 '23 19:03

Florent Giraud