JSFiddle - React, Tailwind, and code Playground

by TheDiamondDoge

JavaScript

var date = new Date();

var options = {
	day: "numeric",
  month: "short",
  year: "numeric"
};

/* alert(formatDate(date)); */
test();

function formatDate(date) {
	var day = date.getDate();
  var month = date.getMonth();
  var year = date.getFullYear();
  
  var monthsNames = [
  	'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
  ];
  
  return day + "-" + monthsNames[month] + "-" + year;
};

function test(){
	console.log(new Date('2019-05-13'))
};