The Short Date Formatter Plugin is a Moment.js is used to display a concise date format similar to that used on the ResearchGate website.
Write the below command in the terminal to install Date Formatter Plugin:
npm install moment-shortformat
The following are some of the functions in this plugin:
- short
The below examples will help to understand some of the methods of the Short Format Plugin.
Example 1:
Javascript
import moment from 'moment' ;
import short from 'moment-shortformat' ;
let date = moment(); console.log(moment(date - 1).short()); |
Output:
Example 2:
Javascript
import moment from 'moment' ;
import short from 'moment-shortformat' ;
let date = moment(); console.log(moment(date + (36e5 * 24 * 2)).short( true ));
|
Output: