JSFiddle - React, Tailwind, and code Playground

by andrewboni

HTML

<body>
    <p>Posted on <time datetime="2013-07-31T05:05Z"></time></p>
</body>

CSS

p {
    font-family: 'Helvetica Neue', arial, sans-serif;
    font-size: 20px;
    color: #525252;
}

JavaScript

function prettyTime(dateString) {
  if (!dateString)
    return 'unknown date';
  var d = new Date(dateString);
  return d.toDateString();
}


$("time").each(function(){
    $(this).html(prettyTime($(this).attr("datetime")))
});