Skip to content

Commit

Permalink
Updated pretty.js to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
sankroh committed Jun 23, 2013
1 parent 3e26bdf commit 1ec2bd0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lastfm.html
Expand Up @@ -7,25 +7,22 @@ <h1>Recently Scrobbled</h1>
<ul id="lastfmList">
<li class="loading">Updating tracks...</li>
</ul>
<script type="text/javascript">
<script lang="Javascript">
/*
* JavaScript Pretty Date
* Copyright (c) 2008 John Resig (jquery.com)
* Licensed under the MIT license.
* Copyright (c) 2011 John Resig (ejohn.org)
* Licensed under the MIT and GPL licenses.
*/

// Takes an ISO time and returns a string representing how
// long ago the date represents.

// modified to return DD MM format instead of undefined.
prettyDate: function (time) {
function prettyDate(time){
var date = new Date((time || "").replace(/-/g,"/").replace(/[TZ]/g," ")),
diff = (((new Date()).getTime() - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);

// return date for anything greater than a day
if ( isNaN(day_diff) || day_diff < 0 || day_diff > 0 )
return date.getDate() + " " + date.toDateString().split(" ")[1];
if ( isNaN(day_diff) || day_diff < 0 || day_diff >= 31 )
return;

return day_diff == 0 && (
diff < 60 && "just now" ||
Expand Down

0 comments on commit 1ec2bd0

Please sign in to comment.