What is Moment.js?
First steps with Moment.js
To install moment.js we will need a package manager, it can be npm or yarn. The following command shows the installation of Moment.js via npm.
npm install moment
After installation, we can import our library into the project and start using it.
const moment = require('moment'); const today = moment(); console.log(today.format('YYYY-MM-DD'));
This format will display the date in the order YEAR-MONTH-DAY.
Attention, Moment.js is no longer supported!