Answered
This topic has been closed for replies.
The full script will need to be a calculation script in the "Week End Date" field.
Remove the date formatting from this field, and make it ReadOnly. Formatting is only needed when dates are entered manually.
The input date will need to be created using the "util.scand" function. And the Output will need to be formatted using util.printd. Like this (same script just using scand and printd to handle the date formatting)
var strWorkDate = this.getField("Work Date").value;
if(strWorkDate != "")
{
var dtStart = util.scand("m/d/yyyy",strWorkDate);
// Sunday is 0, Monday is 1, etc.
var nDayOfWeek = dtStart .getDay();
var dtEndOfWeek = null;
if(nDayOfWeek == 0)
{// Today is Sunday, so today is the end of the week
dtEndOfWeek = dtStart ;
}
else
{// Find number of days until next sunday, then add to current date
nOffsetToSunday = 7-nDayOfWeek;
nSundayDateTime = dtStart.setDate(dtStart.getDate() + nOffsetToSunday);
dtEndOfWeek = new Date(nSundayDateTime);
}
event.value = util.printd("m/d/yyyy",dtEndOfWeek);
}
else
event.value = "";
Sign up
Already have an account? Login
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inSign in to Adobe Community
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.
