how to add moment.js in my code? Is it still possible to work with this library? Is it recommended?
t
Travis Zuri
08/06/2021, 8:51 PM
I'm using it. Just have to add it in the define, like:
define([
'N/query',
'N/record',
'N/runtime',
'./search/search.js',
'N/url',
'SuiteScripts/ZuriSDF/libs/moment.js'
], function (
query,
record,
runtime,
search,
url,
moment
)
b
battk
08/06/2021, 9:08 PM
if you are still trying to set the duedate, then your problem is still using Dates
battk
08/06/2021, 9:09 PM
trying to use moment to manipulate a Date will not fix your problems
d
Danny Kovene
08/11/2021, 6:32 PM
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.
b
battk
08/11/2021, 6:41 PM
unfortunately the javascript environment in suitescript is old enough to be considered legacy
battk
08/11/2021, 6:42 PM
notably the newer date based libraries use Internationalization apis, which suitescript does not implement