You are viewing limited content. For full access, please sign in.

Question

Question

sla

asked on March 4

How to exclude weekends like Friday and Saturday in form sla in lazerfiche 11.

0 0

Replies

replied on March 4

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

 

0 0
replied on March 5

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?

0 0
replied on March 6

Forms 11 does not currently support setting custom weekends. 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.