Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A method to format old JavaScript dates in a "pretty" way. For example "2008-01-28T20:24:17Z" becomes "2 hours ago". Also include a .prettyDate() jQuery plugin, for convenience. Here's some more examples:
- prettyDate("2008-01-28T20:24:17Z") // => "2 hours ago"
- prettyDate("2008-01-27T22:24:17Z") // => "Yesterday"
- prettyDate("2008-01-26T22:24:17Z") // => "2 days ago"
- prettyDate("2008-01-14T22:24:17Z") // => "2 weeks ago"
- prettyDate("2007-12-15T22:24:17Z") // => undefined
Add Comment
Please, Sign In to add comment