intacct / intacct-sdk-js

Official repository of the Sage Intacct SDK for JavaScript in Node.js
https://developer.intacct.com/tools/sdk-node-js/
Apache License 2.0
22 stars 31 forks source link

Date formatting incorrect for Bank Feeds and BankAccountTransactionRecords (?) #131

Open simon-holm opened 2 months ago

simon-holm commented 2 months ago

I'm new to Sage API and attempting to setup a bank feed.

The errors: [ "BL03000113 The Date 'Array' is not valid [Support ID: ....]", 'BL03000018 Format for Bank account transaction feed: Date added ${FLD_REF} is not valid.', 'BL01001973 Unable to validate bankaccttxnfeed record', 'BL01001973 Could not create bankaccttxnfeed record' ]

I printed the XML the SDK generates.

`

2024
<month>05</month>
<day>15</day>

`

According to the XML API docs the feed date should be formatted like this.

<FEEDDATE>05/15/2020</FEEDDATE>

In IaXmlWriter.ts

 public writeDateSplitElements(date: Date, writeNull?: boolean) {
        if (writeNull === null) {
            writeNull = true;
        }

        this.writeElement("year", dateFormat(date, "yyyy"), writeNull);
        this.writeElement("month", dateFormat(date, "mm"), writeNull);
        this.writeElement("day", dateFormat(date, "dd"), writeNull);
    }

This method is used for Feed date in BankFeedsCreate and posting date in BankAccountTransactionRecord.ts. Should perhaps writeElementDate be used instead?