I'm having some trouble getting this installed and working. I am using moment ~2.9.0 and moment-timezone ~0.5.13.
I have
require.config({
paths: {
moment: 'path/to/moment/moment',
moment_tz: 'path/to/moment-timezone/builds/moment-timezone-with-data'
},
shim: {
'moment_tz': {
deps: ['moment'],
exports: 'moment'
},
}
});
define([
'moment_tz'
], function(moment) {
...
});
Interestingly it looks like moment is being installed into global scope instead of being made available through the define.

Any ideas on how to resolve this?
Does this help?
http://momentjs.com/timezone/docs/#/use-it/require-js/
Also, while moment 2.9.0 is the minimum that moment-timezone supports, you should probably use the latest 2.18.1
Thanks @mj1856, I should have mentioned in the issue, that was the first thing I tried:
require.config({
paths: {
...
moment: 'path/to/moment/moment',
}
});
define([
'../../path/to/moment-timezone/builds/moment-timezone-with-data',
], function(moment) {
...
});
But I have the same results. Not sure if it is relevant, but I am also using bootstrap_timepicker which depends on moment. I have also tried moment 2.18.1 with a few different configurations, and haven't been able to get that working either.
I think this is just a syntax error. No parens after moment. Put them after guess instead.
moment.tz.guess()
Edited - because I had an error too at first.
Missed that. lol.
Also, I found that this works too:
require.config({
paths: {
'moment': 'path/to/moment',
'moment-timezone': 'path/to/moment-timezone-with-data',
}
});
require(['moment-timezone'], function (moment) {
var s = moment().tz("America/New_York").format();
console.log(s);
});
Well, that's embarrassing. Thanks both of you for your help. Sorry for the noise.
No problem. Glad we could help.
Most helpful comment
I think this is just a syntax error. No parens after moment. Put them after guess instead.
Edited - because I had an error too at first.