I have a custom due date field on my sales order. ...
# suitescript
a
I have a custom due date field on my sales order. The calculation is triggered on when the customer is chosen. Unfortunately this formula doesn's seem to work. nlapiDateToString(nlapiAddDays(new Date(nlapiGetFieldValue('custbody_aim_due_date')),14)) Any suggestions? thanks (edited)
z
doesn't seem to work ?
wrong results error not triggered
b
using the Date constructor is unreliable, it only works for certain date formats
use nlapiStringToDate instead
a
Almost at the goal, the result is Wed Jan 19 2022 000000 GMT+0100 (Mitteleuropäische Normalzeit) If I use nlapiAddDays(nlapiStringToDate(nlapiGetFieldValue('custbody_issue_date')), 5)
Is there a JS function to format Wed Jan 19 2022 000000 GMT+0100 (Mitteleuropäische Normalzeit) into D/M/YYYY?
b
always D/M/YYYY implies that you dont want a date field
a
How can I make sure that this: nlapiAddDays(nlapiStringToDate(nlapiGetFieldValue('custbody_issue_date')), 5) gives me 19/5/2022?
b
use a text field
pick your favorite date formatting library to format your date