Moment JS is now TypeScript and Webpack compatibile

The latest version of Moment JS, 2.13, has added compatibility for TypeSript and WebPack. They added the src folder to the library as well as a moment.d.ts file. So it all works very smooth now. Here is quickie summary.

Install it:

npm install --save moment

Call it within Aurelia:

import * as Moment from "moment";

export default class DoSomething {
  currentDate: Date;

  constructor() {
    this.currentDate = Moment().toDate();
  }
}

Easy peasy!