how can i convert this raw date using the format ...
# suitescript
s
how can i convert this raw date using the format module
Copy code
"2024-08-08T04:00:00.000Z"  to mmddyyyy
this solution is what is working if anyone has a better idea would love to hear
Copy code
let formattedPortDate = format.format({
      value: new Date(portDate),
      type: format.Type.DATE,
    });
👍 1
e
Yeah this seems about as concise as you can get it
k
I prefer your solution, but here is a small snippet I often use (no libraries needed) when I need control of the date parts (with 2 digits for days/months) in case it helps. let d = new Date('2 AUG 2024'); console.log(
${((d.getMonth()+1)+'').padStart(2,'0')}${(d.getDate()+'').padStart(2,'0')}${d.getFullYear()}
);
s
we have filed an inbound shipment that we are trying to set using the code above but its erroring out
Copy code
Invalid date value (must be M/D/YYYY)
EXPECTED PORT DATE Field ID:  expecteddeliverydate