Anyone know the expected format for the start date...
# suitescript
r
Anyone know the expected format for the start date and statement date in render.statement? I've been trying to use
Copy code
let startDate = new Date();
And it never seems to work. I've also tried to use format.format and format.parse on the variable above without success. I either get a message bout options.startDate must be a string or an "unexpected error" If I remove both dates, then it's happy.
c
Share your actual code
r
Copy code
const dateStatement = new Date();
    const startDateDate = new Date();
    // Set start date to 11 days prior
    startDateDate.setDate(startDateDate.getDate() - 11);

    const startDate = format.format({
      value: startDateDate,
      type: format.Type.DATETIME
    });

    const statementDate = format.format({
      value: dateStatement,
      type: format.Type.DATETIME
    });

    const attachment = render.statement({
      entityId: 1,
      printMode: render.PrintMode.PDF,
      startDate: startDate,
      statementDate: statementDate,
      openTransactionsOnly: true,
      subsidiaryId: 1,
      inCustLocale: true
    });
Well, your Q helped sove it. Was my format type, changing it to format.Type.DATE resolved it
🙌 1