Client Scripts
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 06:03 AM
Hi Community, Hope you all doing well .
I have return this client script to provide 3 days after the current date but I want to exclude weekends when configuring it .Can you please help to configure it
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var currentDateObj = new Date();
var currentDateStr = formatDate(currentDateObj, g_user_date_format);
//alert("TODAY DATE: " + currentDateStr);
var currentDateNum = getDateFromFormat(currentDateStr, g_user_date_format);
var endDateInMS = currentDateNum + 259200000; // Add 3 days in milliseconds to today's date
var endDate = new Date(endDateInMS);
var newValueInMS = new Date(newValue).getTime();
if (endDateInMS > newValueInMS) {
g_form.addErrorMessage("Start Date must be 3 days from request creation date.");
}
alert(endDate);
alert(endDateInMS);
alert(newValue);
alert(newValueInMS);
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 06:10 AM
Th best option is to call a script include and then use the GlideSchedule API. It'll be more future proof, and if the requirements change to exclude weeks and public holidays you'll be setup to do so without needing to change the script