moment.js format
Moment.js is a JavaScript library that helps you parse, validate, manipulate, and display dates and times in JavaScript. It's a library that makes it easy to work with dates and times in JavaScript. Moment.js makes it easy to format dates and times using the familiar strftime syntax. For example, to display a date like October 2nd, 2020, you would do the following:
var date = moment("2020-10-02");
console.log(date.format("MMMM Do, YYYY")); // October 2nd, 2020
You can also use Moment.js to create a formatted date from a string. For example, if you have a string like "03/01/2020", you can use Moment.js to parse it into a Date object.
var dateStr = "03/01/2020";
var date = moment(dateStr, "MM/DD/YYYY");
var date_formatted = date.format("MMMM Do, YYYY"); // March 1st, 2020
Moment.js also makes it easy to add and subtract dates. For example, to add a month to a date, you would do the following:
var date = moment("2020-10-02");
var date_plus_month = date.add(1, 'months');
console.log(date_plus_month.format("MMMM Do, YYYY")); // November 2nd, 2020
Moment.js is a powerful and versatile library that makes it easy to work with dates and times in JavaScript. If you're working with dates and times, it's definitely worth checking out.