WIP Alert This is a work in progress. Current information is correct but more content will probably be added in the future.
Vanilla Date class
var date = new Date() date.toString() // "Wed Aug 10 2016 21:44:00 GMT-0300 (BRT)"
There are many ways to install and use moment.js
For Typescript, just do
npm install momentand then import it like this:
import * as moment from 'moment';
Moment.js is a library that provides a better implementation of the vanilla
Date class with many useful
// equivalent to calling new Date() var date = moment(); date.toString() // "Wed Aug 10 2016 21:44:00 GMT-0300 (BRT)" // but you get extra methods in the object as well date.fromNow() // "a few seconds ago"
Durations (date periods)
Formatting + displaying dates