hello the below code does work on the create issue pop up or when issue type is changed.
it is the code to add business days to due date depending upon the priority value.
any help is appreciated.
<script>
function validate()
{
var now = new Date();
if(document.getElementById("customfield_18094").value == 28180 )
{
days = 5;
}
else
if(document.getElementById("customfield_18094").value == 28181 )
days = 1;
else
days = 3;
var dayOfTheWeek = now.getDay();
var calendarDays = days;
var deliveryDay = dayOfTheWeek + days;
if (deliveryDay >= 6) {
days -= 6 - dayOfTheWeek;
calendarDays += 2;
deliveryWeeks = Math.floor(days / 5);
calendarDays += deliveryWeeks * 2;
}
now.setTime(now.getTime() + calendarDays * 24 * 60 * 60 * 1000);
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var today = new Date();
today = now;
var numberOfDaysToAdd = 7;
//today.setDate(today.getDate() + numberOfDaysToAdd);
var dd = today.getDate();
var mm = today.getMonth();
var yyyy = today.getFullYear();
today = dd + '/' + monthNames[mm] + '/' + yyyy;
document.getElementById("customfield_18091").value = today;
if(!document.getElementById("customfield_18091").value)
{alert("empty")}
return false;
}
document.getElementById("customfield_18094").addEventListener("change", validate);
</script>
Do you get any error message from the browser console?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.