jQuery.fn.sortByDate = function(options) {
  
  var opts = jQuery.extend({
    "has-more-button" : true
  }, options);
  
  var dex = 0;
  while (dex < ($("li", this).size() - (opts["has-more-button"] ? 1 : 0))) {
    var oldest = null;
    var oldDate = "";
    $("li" + (dex > 0 ? ":gt(" + (dex - 1) + ")" : ""), this).each(function() {
        if ($(this).children("a").children("strong").text() != "View All") {
          if (oldest == null) {
            oldest = this;
            oldDate = $(this).children("a").children("strong").text();
            oldDate = new Date(oldDate);
          } else {
            var newDate = $(this).children("a").children("strong").text();
            newDate = new Date(newDate);
            if (newDate < oldDate) {
              oldest = this;
              oldDate = newDate;
            }
          }
        }
    });
    if (oldest != null) {
      $(oldest).prependTo($(this));
    }
    dex++;
  }
  
}
