This message was deleted.
# suitescript
s
This message was deleted.
c
Share more code, that snippet does not show the problem. Note that
format.format
returns a string,
format.parse
returns a Date object. https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4388721627.html
d
Copy code
let date = moment(date).subtract(1, 'days');

date = format.parse({
    value: subCurrStartDate,
    type: format.Type.DATETIMETZ
});

log.debug(typeof subCurrStartDate, subCurrStartDate);
// "2022-08-03T07:00:00.000Z"
record.submitFields({
    type: 'field',
    id: id,
    values: {'field1': date}
});
c
Copy code
subCurrStartDate
?
a
he literally logged it for you?
c
No, I was about to ask if the variables are in the right places. The first
date
line is redundant?
a
this code also use .parse but not .format. so I'm a little confused too to be honest
c
indeed
b
not enough information given, setting a date field by value requires using a Date object
using a iso-8601 string like " "2022-08-03T070000.000Z"" will always fail, no netsuite date time format matches that