@richardshergold wrote:
I've been using the moment.js library within my two Ionic 2 projects and it has worked ok without problems. I've now upgraded my projects (from alpha40 to alpha46) and I now get an error when I try to use the library.
In my package.json I have moment specified as a dependency:
"moment": "^2.10.6"
This seems to bring the package in ok (its listed under node-modules in my project).
In my code I import it like this at the top:
import * as moment from 'moment';
but when I try to use it i.e
this.currentDate = new Date(); this.currentDateMoment = new moment(this.currentDate);
I get an error of:
TypeError: Object is not a constructor (evaluating 'new moment(this.currentDate)')
Like I said, this all worked fine in alpha40. Anyone have any ideas what I need to change to get this to work again? Is is something to do with new Ionic 2 project structure or something (i.e my code being in the app folder instead of the www folder ?)
I have a funny feeling the Conference app used to use the moment.js library was well but it looks like it doesn't any more.
Posts: 6
Participants: 3