StephenChou1017 / react-big-scheduler

A scheduler and resource planning component built for React and made for modern browsers (IE10+)
https://stephenchou1017.github.io/scheduler/#/
MIT License
754 stars 414 forks source link

Help: Per Day Time Window #130

Open FizzBuzz791 opened 5 years ago

FizzBuzz791 commented 5 years ago

I tried using the Custom Time Window example to have different working hours (dayStartFrom and dayStopTo) based on the day of the week, but couldn't get it happening.

Is it possible? Or am I trying to be too complicated?

StephenChou1017 commented 5 years ago

@FizzBuzz791 Hi, it's possible. just set schedulerData.config.dayStartFrom and dayStopTo to achieve this.

FizzBuzz791 commented 5 years ago

It doesn't seem to be updating?

Based on the example, I've done this;

prevClick = (schedulerData)=> {
    schedulerData.prev();
    schedulerData.setEvents(DemoData.events);

    if(schedulerData.localeMoment(schedulerData.startDate).isoWeekday === 6) {
        schedulerData.config.dayStopTo = 4
    }

    this.setState({
        viewModel: schedulerData
    })
}

It doesn't seem to change from the default dayStopTo = 21 though?

StephenChou1017 commented 5 years ago

@FizzBuzz791 To check if it's worked, you can do like this and then check the effects:

prevClick = (schedulerData)=> {
    schedulerData.config.dayStopTo = 4;

    schedulerData.prev();
    schedulerData.setEvents(DemoData.events);

    this.setState({
        viewModel: schedulerData
    })
}