JSFiddle - React, Tailwind, and code Playground

by jazahn

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.4.1/jquery.timeago.js "></script>

JavaScript

var test_dates = [
    '2015-06-18T19:48:20Z', '2015-06-18T19:48:20 UTC',
    '2015-06-18T19:38:55Z', '2015-06-18T19:38:55 UTC',
    '2015/06/18', '06/18/2015'
];

var fixDate = function(date){
  return date.replace(/ UTC$/, 'Z');  
};

console.clear();
test_dates.forEach(function(v, i, a) {
    //v = fixDate(v);
    console.log(i, v, " => ", new Date(v), Date.parse(v));
});