maurogestoso
10/16/2017 - 10:57 AM

Code examples for a blog post on using Moment.js

Code examples for a blog post on using Moment.js

const uglyDate = '29–03–1989';

// parse the ugly date with a specific format
const niceDate = moment(uglyDate, 'DD-MM-YYYY');

// format the date into our nice, custom format
console.log(niceDate.format('ddd MMM Do, YYYY'));  // Wed Mar 29th, 1989