Tuesday, July 14, 2015

SharePoint Calendar: Change displayed time range on day/week view of calendar

One of my clients asked me to restrict the time range for  day/week view. They wanted to show only the working hours in views i.e. 9AM to 5PM.

Solution:
I changed the regional settings to specify working hours as 10 AM to 5PM and then I applied the below script.

/* Hiding timings 5pm onwards */
.ms-acal-detail tr:nth-child(37){
    display: none !important;
}
.ms-acal-detail tr:nth-child(38){
    display: none !important;
}
.ms-acal-detail tr:nth-child(39){
    display: none !important;
}
.ms-acal-detail tr:nth-child(40){
    display: none !important;
}
.ms-acal-detail tr:nth-child(41){
    display: none !important;
}
.ms-acal-detail tr:nth-child(42){
    display: none !important;
}

/* changing color of off timing */
.ms-acal-outday{
    background-color:white !important;
}

No comments:

Post a Comment