JSFiddle - React, Tailwind, and code Playground

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-dateFormat/1.0/jquery.dateFormat.min.js"></script>
<p><span class="time">2014-02-24 10:38:19</span></p>
<p><span class="time">2014-02-23 16:38:19</span></p>
<p><span class="time">2014-02-22 16:38:19</span></p>
<p><span class="time">2013-02-22 16:38:19</span></p>

JavaScript

var today = "2014-02-24",
    yesterday = "2014-02-23",
    year = "2014";

$('.time').each(function() {
   $this = $(this);
   if (today === $.format.date($this.html(), "yyyy-MM-dd") || yesterday === $.format.date($this.html(), "yyyy-MM-dd")) {
      $this.html($.format.prettyDate($this.html()));
   } else if (year !== $.format.date($this.html(), "yyyy")) {
       $this.html($.format.date($this.html(), "MMM D - yyyy"));
   } else {
       $this.html($.format.date($this.html(), "MMM D"));
   }
});