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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

custom work hours

Thread ID:

Created:

Updated:

Platform:

Replies:

147815 Sep 25,2019 03:20 AM UTC Oct 24,2019 09:35 AM UTC Angular - EJ 2 7
loading
Tags: Schedule
jose lara
Asked On September 25, 2019 03:20 AM UTC

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
.....
....
.... 

Karthigeyan Krishnamurthi [Syncfusion]
Replied On September 25, 2019 06:27 AM UTC

 
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  
 
 


jose lara
Replied On October 6, 2019 10:26 PM UTC

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')

Karthigeyan Krishnamurthi [Syncfusion]
Replied On October 7, 2019 10:10 AM UTC

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 
 


jose lara
Replied On October 7, 2019 11:03 PM UTC

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.  

Hareesh Balasubramanian [Syncfusion]
Replied On October 8, 2019 01:24 PM UTC

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 


jose lara
Replied On October 24, 2019 12:20 AM UTC

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


Vinitha Devi Murugan [Syncfusion]
Replied On October 24, 2019 09:35 AM UTC

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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon