Hi All,
I am currently using Ionic 2 (Angular 2 RC 4)
I am trying to make use of Moments
in order to format dates.
The latest version of Moment
is 2.14.1, which is avaialble for Angular 2 RC 6. So when I run the install command, I get:
npm install moment --save myApp@ E:\Development\IDE\ionic-apps\myApp +-- UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.4 `-- moment@1.7.2
The problem is with 1.7.2, I get the following TS error:
import * as Moment from 'moment'; [ts] Cannot find module 'moment'. ERROR in ./app/pages/chats/chats.ts (1,25): error TS2307: Cannot find module 'moment'.
If I install the latest version 2.14.1, of Moments
, I do not get this error. But it does compalin that I need Angular 2 RC 6.
As advised here, if we are using Ionic 2, we should stay on Angular RC 4, and not upgrade to RC 5, let alone 6.
Does anyone know how to get Moments
to work on Ionic 2?
This and this (which I am trying to implement when I get this error) seem to indicate it is possible with Ionic 2. So I am guessing my versions are not compatible.
Thanks
p.s. moment
, not to be confused with angular2-moment
.
"dependencies": { "@angular/common": "^2.0.0-rc.4", "@angular/compiler": "^2.0.0-rc.4", "@angular/core": "^2.0.0-rc.4", "@angular/forms": "^0.2.0", "@angular/http": "^2.0.0-rc.4", "@angular/platform-browser": "^2.0.0-rc.4", "@angular/platform-browser-dynamic": "^2.0.0-rc.4", "@ionic/cloud-angular": "^0.4.0", "angular2-moment": "^1.0.0-beta.1", "es6-shim": "^0.35.0", "ionic-angular": "^2.0.0-beta.11", "ionic-native": "1.3.2", "ionicons": "3.0.0", "moment": "^1.7.2", "reflect-metadata": "^0.1.3", "rxjs": "5.0.0-beta.6", "socket.io": "^1.4.8", "zone.js": "^0.6.12" },