How to use `moment.js` with Meteor?

前端 未结 5 536
青春惊慌失措
青春惊慌失措 2020-12-06 11:28

I am wanting to use momentjs with meteor. This is an npm package, so from what I understand, it cannot be used with meteor because meteor uses it\'s own package system. So

5条回答
  •  粉色の甜心
    2020-12-06 12:11

    The question was asked 3 years ago, at that time there was no official package from atmosphere. Since the question was asked things changed and I point out when the package was added to meteor repos.

    Install the official package from atmosphere

    meteor add momentjs:moment
    

    if you are using typescript, just

    import * as moment from "moment/moment";
    

    then in your code

    let date = moment().format('YYYY MM DD');
    

提交回复
热议问题