I really hate the way netsuite suite script 2.0 handles date formatting. So, I would like to use Moment.js for parsing dates that I get back from a web service call. How do I get this to work inside a suite script 2.0?
As erictgrubaugh stated, I needed to add the moment.js library to the NetSuite file cabinet and then in the debugger use the library. Also note that my script is in File Cabinet -> SuiteScripts -> Libraries
But even so, I was having problems with the syntax. Because when I use the debugger it now doesn't throw any errors, but I can't step through any of the code and a log statement doesn't print anything.
/** * @NApiVersion 2.x
* @NScriptType ScheduledScript
*/
define ([
'N/log',
'../Libraries/moment',
],
function(log, moment) {
var a = moment('2016-01-01');
var b = a.clone().add(1, 'week');
log.debug(b);
});