Ionic 2 moment-timze is not able to find tz method

I am installing moment package but , its method tz everytime gives Error - not able to find but other method working fine.

Please tell me what is moment timzone command?


and you installed both:

  • moment
  • moment-timezone


yes, I have installed both. And I am following

Also try to installed using typings.

okay so you ran:

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


not using @types

$ npm install -g typings
$ typings search moment
$ typings install dt~moment --save
$ typings install dt~moment-timezone --save --global

Where dt is source to install moment-timezone and --global is required.

pls try my command. in newer versions typings are stored under @types

Ok, I will try do that. But what I will code at top to import.
import * as moment from ‘moment’;

then for moment-timezone?

yeah maybe:

import moment from 'moment'; import 'moment-timezone';
something like that. you have to play around a little bit on your own

Getting error -
Uncaught Error: Cannot find module "./data/packed/latest.json"
at webpackMissingModule (main.js:122432)
at Object. (main.js:122432)
at webpack_require (main.js:20)
at Object. (main.js:44108)
at webpack_require (main.js:20)
at Object. (main.js:44208)
at webpack_require (main.js:20)
at Object. (main.js:101584)
at webpack_require (main.js:20)
at Object. (main.js:101495)

yeah, but that looks like you have an invalid path somewhere in your app.

it is searching for ./data/packed/latest.json". So do you have a http-call something else to this file?

No. Actually moment need two to three file for timezone as you can see in moment timezone site and @type/moment-timezone has nothing which is required for timezone.

I have also installed in other example using npm where moment has three to foure file with moment-timezone name.

I have the same problem. Any solution ?