we are getting a day off through the <netsuite.com...
# ask-stanley-ai
p
we are getting a day off through the netsuite.com connector from the date stored in NetSuite versus the date coming from the message table. how can we fix the date in the messages table to what is being displayed in netsuite through the connector?
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** The issue you're experiencing with the date discrepancy between the message table and NetSuite through the connector is likely due to timezone differences. When you're storing a date in NetSuite, it's stored in the Pacific Standard Time (PST) timezone by default. If your system's timezone is different, this can cause a day's difference when the date is retrieved. To fix this, you need to handle the timezone before setting the date in the field. When you're creating a new Date object in JavaScript, if you don't specify a timezone, it assumes UTC. So, when you're setting the date, you should include the timezone information in the date constructor. Here's an example of how you can do this:
Copy code
javascript
var dateStr = "2023-06-05T19:00:000+2:00"; // CET timezone
var dateObj = new Date(dateStr);
rec.setValue({fieldId: "custrecord_date", value: dateObj});
In this example,
2023-06-05T19:00:000+2:00
represents the date in the Central European Time (CET) timezone. When this date is stored in NetSuite, it will be converted to Pacific Time. However, please note that this solution might not work for all hours of the day due to the timezone difference between CET and PST. You might need to adjust the time in your date string accordingly to ensure the date remains correct after the conversion. Also, remember that the user's NetSuite timezone is irrelevant for normal date fields. The date is always stored in PST in NetSuite, regardless of the user's timezone settings.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837150812
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83545512
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829553664
Please provide your feedback on this answer.