How to count days from start and end date in pdf form?
Hi my question is how to write java script for conting days from start and end date?
I found and I use this script:
// Custom calculate script
(function () {
var sStart = getField("fill_9").valueAsString;
var sEnd = getField("fill_10").valueAsString;
var dStart, dEnd, diff;
if(sStart && sEnd) {
dStart = util.scand("dd/mm/yyyy", sStart);
dEnd = util.scand("dd/mm/yyyy", sEnd);
diff = dEnd.getTime() - dStart.getTime();
event.value = Math.floor(diff / 864e5)+1;
} else {
event.value = "";
}
})();
It's work but not correctly, if I put in fill_10 date less than fill_9 the result in fill_8 where is my counter is 0 or negative value for example -1 or -2 and so...
How can I restrict the counter to show appalert when the counter is 0 or negative?
And the user should enter the dates for fill_9 and fill_10 again?
