Hey everyone. We've got a script that consumes inf...
# suitescript
r
Hey everyone. We've got a script that consumes info from an integrated solution; it brings over line level data into a custom record. On the import file, we've got columns 12 and 13 with dates... these dates come to us as YYYY-MM-DD, but NetSuite is seemingly not a fan of that and has been ignoring the dates ... so we've tried to use the FormatDate function for those particular columns, but still aren't seeing the data imported. Do you have any suggestions on how to resolve? // Start Date pObj.custrecord_promo_start_date = formatDate(rows[i][12]); // End Date pObj.custrecord_promo_end_date = formatDate(rows[i][13]);
//the date format function... function formatDate(date) { var strDate = date.toString(); var dArr = strDate.split("-"); var returnDate = [dArr[1], dArr[2], dArr[0]].join("/"); return returnDate;
j
If you're trying to set a field value in SS2.0, NetSuite seems to not like the date object unless it was produced from a string that conforms to the date format account preference.
I usually wind up using moment.js to parse and reformat date strings from various sources
r
That sounds like it'll work! Thanks @jkabot!