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 here are my questions:
2017 EDIT: As of Meteor 1.4+, npm package management allows for standard imports of npm modules and named imports of Atmosphere modules.
Moment construction falls back to js Date. This is discouraged and will be removed in an upcoming major release. This deprecation warning is thrown when no known format is found for a date passed into the string constructor.
MomentJS is a JavaScript library which helps is parsing, validating, manipulating and displaying date/time in JavaScript in a very easy way. This chapter will provide an overview of MomentJS and discusses its features in detail. Moment JS allows displaying of date as per localization and in human readable format.
There are several libraries out there that can potentially replace Moment in your app. The creators of Moment recommend looking into Luxon, Day. js, date-fns, js-Joda, or even replacing Moment with native JS.
Moment. js is a fantastic time & date library with lots of great features and utilities. However, if you are working on a performance sensitive web application, it might cause a huge performance overhead because of its complex APIs and large bundle size.
2017 UPDATE - Meteor 1.4+ uses npm
modules with ES6. OP is from 2013.
Thus...
The npm-only way:
install moment
to your meteor project with npm
and import
in this manner...
$ cd /path/to/my/meteor/project
$ npm install --save moment
// inside your Meteor app files...
import moment from 'moment';
The meteor-npm way with a blanket import: (Thx, @Dave Gööck)
$ cd /path/to/my/meteor/project
$ meteor npm install --save moment
// Inside Meteor app...
import * as moment from 'moment';
// OR
import moment from 'moment';
More about Meteor-npm package imports here. (Specifically mentions moment
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With