eminero
10/08/2024, 1:51 AMCeligo AI
10/08/2024, 1:51 AMAI 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. ****** To use moment and moment-timezone in a server-side script, you need to include them in the define block of your SuiteScript file. Here is an example:
javascript
define([
'N/query',
'N/record',
'N/runtime',
'./search/search.js',
'N/url',
'SuiteScripts/ZuriSDF/libs/moment.js'
], function (
query,
record,
runtime,
search,
url,
moment
)
In the above example, 'SuiteScripts/ZuriSDF/libs/moment.js' is the path to the moment.js file in the file cabinet. You need to replace it with the actual path to your moment.js file.
For moment-timezone, it expects there to be a module named moment. You can accomplish this without modifying moment timezone by using a require config. However, this might be a bit more complex and might not be the easiest way.
Please note that the JavaScript environment in SuiteScript is old enough to be considered legacy. The official momentjs documentation suggests only using it for legacy projects and moving to a newer library for new development. There are several suggestions on the momentjs website.
Also, please be aware that trying to use moment to manipulate a Date will not fix your problems if you are still trying to set the due date. The problem is still using Dates.Celigo AI
10/08/2024, 1:51 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838482082
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838375449
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836433351
Celigo AI
10/08/2024, 1:51 AM