Skip to content

Instantly share code, notes, and snippets.

@chrismendis
chrismendis / prettyTweetDateForTumblr.js
Created December 1, 2010 21:22
Change the dates returned by Tumblr's tweet.js callback to something like 12:00 PM Oct. 27th
var prettyTweetDate = function (tweetDateFromJSON) {
var createDate = Date.parse(tweetDateFromJSON),
tweetDate = new Date(createDate),
tweetDateNum = tweetDate.getDate(),
tweetHours = tweetDate.getHours(),
tweetAMPM = (tweetHours < 12) ? "AM" : "PM",
tweetDateSuffix = "",
prettyTweetDateString = "",
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}