Answered
How do I increment the date that is displayed in a date field using JavaScript? I've read Thom parker's "Working with date and time in Acrobat" and here is my feeble attempt:
var oneDay = 24 * 60 * 60 * 1000;
var strStart = xfa.resolveNode("DateStart").rawValue;
var dateStart = util.scand("yyyy-mm-dd",strStart);
var dueMillis = dateStart.getTime() + oneDay;
var newDate = new Date(dueMillis);
// This is where my problem lies.
xfa.resolveNode("Table1.Row1[" + nIndex + "].DATE").rawValue = newDate.rawValue;
The date field that I want to increment is DateStart. I'm stuck. Can someone please tell me what I'm doing wrong? Any and all help will be greatly appreciated.
I’ve noticed two things:
1. The nIndex variable isn’t defined in the snippet provided.
2. Don’t use the xfa property ‘rawValue’ to access the value of the variable newDate. All you need is
xfa.resolveNode("Table1.Row1[" + nIndex + "].DATE").rawValue = newDate;
Hope this helps,
Hélène