How to exclude weekends like Friday and Saturday in form sla in lazerfiche 11.
Question
Question
Replies
Assuming you want this in a date picker on a form?
This script blocks Saturday and Sunday. See below for modifications.
Use the classic form. Add a date field. Set the css of the date picker to myLimitedDate
$(document).ready(function(){
var today = new Date();
var startDate = new Date();
startDate.setDate(today.getDate() + 1);
var endDate = new Date();
endDate.setDate(today.getDate() + 180);
var minDate = $.datepicker.formatDate('yy-mm-dd', new Date(startDate));
var maxDate = $.datepicker.formatDate('yy-mm-dd', new Date(endDate));
$('.myLimitedDate input').attr('min', minDate);
$('.myLimitedDate input').attr('max', maxDate);
function isValidDate(n) {
var t = n.getDay();
return (t != 6 && t != 0);
}
function checkDate(n) {
return [isValidDate(n), ""];
}
function checkField(input, inst) {
if ($(input).closest('li').hasClass('myLimitedDate')) {
$(input).datepicker("option", {beforeShowDay: checkDate});
}
}
$.datepicker.setDefaults({beforeShow: checkField});
window.Parsley.addValidator('limiteddate', {
validateString: function(value) {
return isValidDate(moment(value, "YYYY-MM-DD").toDate());
},
messages: {
en: 'Not a valid date.'
}
});
$('.myLimitedDate input').attr('data-parsley-limiteddate', '');
});
To block Friday and Saturday, change this line:
return (t != 6 && t != 0);
to
return (t != 5 && t != 6);
Or if you want to block Friday, Saturday, and Sunday:
return (t != 5 && t != 6 && t != 0);
Thanks for your response but :
-
I need to create a report that shows how long each user task took to complete. However, I need the calculation to exclude non-working hours, weekends, and holidays.
-
Is there a built-in way in Laserfiche to calculate the task duration based on a business calendar?
-
-
I would also like to configure a timer on a user task but exclude weekends.
-
In our organization, the weekend is Friday and Saturday, not Saturday and Sunday.
-
Is there a way to configure the timer or SLA in Laserfiche Forms so that Friday and Saturday are excluded from the calculation?
-