Angular 2 - How to import moment-timezone

2,283 views
Skip to first unread message

Jason Nguyen

unread,
Jul 19, 2016, 9:52:31 PM7/19/16
to AngularJS

Hi, I'm trying to import moment-timezone to my app, 
I did used typings to install moment-timezone by running this command:
typings install moment-timezone --ambient --save

and import to my page:

import * as moment from 'moment';
import 'moment-timezone';

Moment works but when I call moment.tz, it shows property tz not found.

Jason Nguyen

unread,
Jul 20, 2016, 11:54:48 PM7/20/16
to AngularJS

I found solution, run

typings install moment-node --save --ambient

will solve the problem.

Arlo

unread,
Jan 26, 2017, 4:00:08 PM1/26/17
to Angular and AngularJS discussion
For TypeScript 2, use @types:

npm install @types/moment-timezone --save-dev


Reply all
Reply to author
Forward
0 new messages