rem: myDate.setDate(myDay + i); 
context: function calcDuration(f) {	var int_st_date = new String(f.task_start_date.value + f.start_hour.value + f.start_minute.value);	var int_en_date = new String(f.task_end_date.value + f.end_hour.value + f.end_minute.value);	var sDate = new Date(int_st_date.substring(0,4),(int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10), int_st_date.substring(10,12));	var eDate = new Date(int_en_date.substring(0,4),(int_en_date.substring(4,6)-1),int_en_date.substring(6,8), int_en_date.substring(8,10), int_en_date.substring(10,12));		var s = Date.UTC(int_st_date.substring(0,4),(int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10), int_st_date.substring(10,12));	var e = Date.UTC(int_en_date.substring(0,4),(int_en_date.substring(4,6)-1),int_en_date.substring(6,8), int_en_date.substring(8,10), int_en_date.substring(10,12));	var durn = (e - s) / hourMSecs; //hours absolute diff start and end	//now we should subtract non-working days from durn variable	var duration = durn  / 24;	var weekendDays = 0;		var myDate = new Date(int_st_date.substring(0,4), (int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10));	for (var i = 0; i < duration; i++) {		//var myDate = new Date(int_st_date.substring(0,4), (int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10));		var myDay = myDate.getDate();		myDate.setDate(myDay + i);		if ( !isInArray(working_days, myDate.getDay()) ) {			weekendDays++;		}	}		//calculating correct durn value	durn = durn - weekendDays*24;	// total hours minus non-working days (work day hours)	//could be 1 or 24 (based on TaskDurationType value)	var durnType = parseFloat(f.task_duration_type.value);		durn /= durnType;	if (durnType == 1){		// durn is absolute weekday hours		// Hours worked on the first day		var first_day_hours = cal_day_end - sDate.getHours();		if (first_day_hours > daily_working_hours)			first_day_hours = daily_working_hours;		// Hours worked on the last day		var last_day_hours = eDate.getHours() - cal_day_start;		if (last_day_hours > daily_working_hours)			last_day_hours = daily_working_hours;		// Total partial day hours		var partial_day_hours = first_day_hours + last_day_hours;		// Full work days		var full_work_days = (durn - partial_day_hours) / 24;		// Total working hours		durn = Math.floor(full_work_days) * daily_working_hours + partial_day_hours;	} else if (durnType == 24 ) {		//we should talk about working days so task duration equals 41 hrs means 6 (NOT 5) days!!!		if (durn > Math.round(durn))			durn++;		}	if ( s > e )		alert( 'End date is before start date!');	else		f.task_duration.value = Math.round(durn);}
meta: 6222	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/6222/fb2da815a5947ee8bc36e9f2c979c012e508dbf2/addedit.js/clean/dotproject/modules/tasks/addedit.js