We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

custom work hours

Hi, I want to display different work hours for different days. I only see a global setting that applies to all days of the week. How do I do this? 

Monday          8AM-5PM
Tuesday          9AM-3PM
Wednesday    11AM-4PM
.....
....
.... 

7 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team September 24, 2019 10:27 PM

 
Syncfusion greetings. 
 
Currently it is not possible in Scheduler and we have already logged it as feature request, which will be implemented in any one of our upcoming main release. 
 
In the meantime, kindly use  setWorkHours method to customize the wrok hours based on dates like below.   
 
Regards, 
Karthi  
 
 



JL jose lara October 6, 2019 02:26 PM

ok thx. I am still not able to achieve what I am looking for using the solution you mentioned above. In the example below, how can I set different start and end time for 10/7 and 10/8? In the example below, the start and end date would be the 10 AM and 2:30PM. But, how can I set two different start and end time for those 2 days?


let dates: Date[] = [new Date('2019/10/07'),new Date('2019/10/08')];
this.scheduleObj.setWorkHours(dates, '10:00','14:30')


KK Karthigeyan Krishnamurthi Syncfusion Team October 7, 2019 02:10 AM

Hi Jose, 
 
Thanks for the update. 
 
In the below sample, work hours is disabled by default and highlighted different hours for Feb 12 and 13 on initial load. 
 
onDataBinding(args): void { 
    if (this.flag) { 
      if ( 
        this.scheduleObj.currentView !== "Month" && 
        this.scheduleObj.currentView !== "Agenda" 
      ) { 
        var currentViewDates: any = this.scheduleObj.getCurrentViewDates(); 
        for (var i = 0; i < currentViewDates.length; i++) { 
          switch (currentViewDates[i].getDay()) { 
            case 1: 
              this.scheduleObj.setWorkHours( 
                [currentViewDates[i]], 
                "06:00", 
                "08:00" 
              ); 
              break; 
            case 2: 
              this.scheduleObj.setWorkHours( 
                [currentViewDates[i]], 
                "07:00", 
                "09:00" 
              ); 
              break; 
          } 
        } 
      } 
      this.flag = false; 
    } 
  } 
 
Note:  Above solution is based on day index and if you want to achieve it instead of date, call setWorkHours method with each date as param. 
 
Regards, 
Karthi 
 



JL jose lara October 7, 2019 03:03 PM

that worked perfectly thx! One last question - how can I assign a different color for non-working hours? Currently, the color difference between working and non-working hours are too light to see.  


HB Hareesh Balasubramanian Syncfusion Team October 8, 2019 05:24 AM

Hi Jose, 

Thanks for the update. 

we have achieved your requirement through CSS itself. Please refer the below code snippet and sample link, 
 
code snippet: 
.e-schedule .e-vertical-view .e-work-cells.e-work-hours { 
    background-color: grey; 
} 
.e-schedule .e-vertical-view .e-work-cells { 
    background-color: lightgray; 
} 
 
And for further reference, please view the below sample link, 
 
Regards, 
Hareesh 



JL jose lara October 23, 2019 04:20 PM

thx. Karthigeyan's example to set work hours worked. How do I block the time outside of working hours? 



VD Vinitha Devi Murugan Syncfusion Team October 24, 2019 01:35 AM

Hi Jose, 
 
Thanks for the update. 
 
We have prepared the sample based on the requirement which is available in below link, 
 
 
In the above sample, we have prevented the non-working hour interactions by overriding the CSS classes of e-work-cells like below, 
 
.e-schedule .e-vertical-view .e-work-cells.e-work-hours { 
    background-color: grey; 
    pointer-events: all !important; 
} 
 
.e-schedule .e-vertical-view .e-work-cells { 
   pointer-events: none; 
   background-color: #F0F0F0 ; 
 
   } 
 
 
 
Regards, 
M.Vinitha devi 


Loader.
Live Chat Icon For mobile
Up arrow icon