moment for angular code example

Example 1: angular moment

npm install --save moment
...
import * as moment from 'moment';

Example 2: moment use in angular

npm install --save moment
import * as moment from 'moment';
...
let myMoment: moment.Moment = moment("someDate");

Example 3: moment

moment("20111031", "YYYYMMDD").fromNow(); // há 9 anos
moment("20120620", "YYYYMMDD").fromNow(); // há 8 anos
moment().startOf('day').fromNow();        // há 13 horas
moment().endOf('day').fromNow();          // em 11 horas
moment().startOf('hour').fromNow();       // há 10 minutos