I would like to config default moment tiemzone in my project.
Please help me.
Meteor.startup(function() {
moment.tz.setDefault("America/New_York");
});
Have a look at the online documentation.
Thanks, it work for client only?
It should work on the server too.
So could I use in common
folder?
Yes, it should work.
I tried but don’t work Cannot call method 'setDefault' of undefined
.
This is probably because the Moment Timezone library is not loaded on the server side. Where/how did you added the library?
I added momentjs:moment
I’m unsure if the Timezone component of Moment is part of this package. You may have to add it manually.
What do you think dispatch:date-tools
?
In general i would not advise you to use the atmosphere wrapper packages for third party code like moment.js – they are always lagging behind and you loose a lot of control.
I go with standard bower (http://bower.io/) which is always up to date and easier to manage your third party dependencies. Then include them like any other file (e.g: api.addFiles([‘bower_components/moment/moment.js’]); in your package.js
meteor add mrt:moment-timezone