how to add moment.js in my code? Is it still possi...
# suitescript
s
how to add moment.js in my code? Is it still possible to work with this library? Is it recommended?
t
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
if you are still trying to set the duedate, then your problem is still using Dates
trying to use moment to manipulate a Date will not fix your problems
d
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
unfortunately the javascript environment in suitescript is old enough to be considered legacy
notably the newer date based libraries use Internationalization apis, which suitescript does not implement