You can use Sundial to find the difference between a date and the current time in human readable form (eg. Yesterday at 2:11pm).
sundial.humanDiff('2014-11-02T20:08:11.551Z '); // Yesterday at 8:08pm
Date object into a readble date or readable time using the following methods.
sundial.formattedDate(new Date()); // Aug 20 sundial.formattedTime(new Date()); // 2:11pm
Or, if you want, you can use the
formattedDateTime method to get the date and time part combined.
sundial.formattedDateTime(new Date()); // Aug 20 @ 2:11pm
I had to write this code to implement the same in my own projects and thought it would be useful to many others too. I am planning to make it a more robust and feature-rich to work with time and dates (but no promises yet). - Mohit Mamoria
The Sundial project is open-sourced software licensed under MIT license.