Copy link to clipboard
Copied
I want a value returned in Text1 field based on a date in Date1 field. For instance if the date in the Date1 text field is todays date or before than the value in the Text1 field should be "Expired" if the value in the Date1 text field is tomorrow or any time in the future than the value in the Text1 field should be "Expires"
Copy link to clipboard
Copied
What's the format of the value in Date1?
Copy link to clipboard
Copied
dd/mm/yy
Copy link to clipboard
Copied
However the date could be 3/1/16
Copy link to clipboard
Copied
not sure if that is still dd/mm/yy or d/m/yy
Copy link to clipboard
Copied
You can use this code as the custom calculation code for Text1:
event.value = "";
var s = this.getField("Date1").valueAsString;
if (s!="") {
var d = util.scand("dd/mm/yy", s);
d.setHours(0);
d.setMinutes(0);
d.setSeconds(0);
d.setMilliseconds(0);
var now = new Date();
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
now.setMilliseconds(0);
if (d) {
if (d.getTime()<=now.getTime()) event.value = "Expired";
else event.value = "Expires";
}
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now