JSFiddle - React, Tailwind, and code Playground

by apasaja

JavaScript

function formatDate(date) {
  var d = new Date(date),
        month = '' + (d.getMonth() + 1),
        day = '' + d.getDate(),
        year = d.getFullYear();
        
    console.log('date:', d)

    return [year, month, day].join('');
}

console.log(formatDate("2/29/2020"));