This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I need to come up with a leave application script. For example i have 21days of annual leave. If i select today from the drop down box and one week later in the other drop down, the script will automaticall minus 7 days out of the 21 days. I'm able to do this part. The script as follows :
var sDate = nForm['dc1'].value; sDate = sDate.split('-'); sDate = new Date(sDate,sDate-1,sDate) var eDate = nForm['dc2'].value; eDate = eDate.split('-'); eDate = new Date(eDate,eDate-1,eDate) nForm['daysApart'].value = (eDate-sDate)/86400000; nForm['hiddenElmName'].value=nForm['daysApart'].value alert(nForm['daysApart'].value);
return true; }
I'm not sure how to modify the script when half days are taken. For example if i take 2.5 days of leave the script must be able calculate that there is 19.5 days of leave left. There will be 2 radio buttons, One called "Full day" the other "Half Day"