For reference I’m just doing something like this: ...
# suitescript
a
For reference I’m just doing something like this:
Copy code
var date = new Date('date_time_string_here');
cust_record.setValue({
    fieldId: 'custrecord_date',
    value: date
});
e
Try using the format module perhaps
a
Unfortunately the Format Module isn’t doing it for me either. My usual methods aren’t working so I’ll try a few more things.
c
you gotta cut the seconds off
👍 1
a
@creece Oh my god why is that a thing.
c
netsuite
a
oddly, I can input seconds from the UI. Is that intended or does the UI allow you to input seconds because UI?
c
yep
a
….I want to cry.
j
My experience is that when you set a date field on the server, NetSuite complains if the string you use to create the date object is not in the date string format set under company peferences. E.g. if the company preference is MM/DD/YYYY, when you do
new Date(date_string_here)
,
date_string_here
must be in MM/DD/YYYY
b
alternate take, don't do local strings with the Date constructor, use ISO-8601 or use the milliseconds since epoch
j
I've had the issue I described above with dates created with ISO 8601 strings with code running on the server. IIRC the Rhino engine complains that the Java class behind the Date object is not the right class as expected by the NetSuite application, and changing it to use strings according to the company preference got around that
I've not tried milliseconds, but it sounds like it could be even more foolproof ... hopefully enough for NetSuite