A small helper function to beautify dates in Javascript.
Pretty date only has one function: prettyDate(date)
. It feeds
the input date into a Javascript Date object and all the same input formats, the Date object does.
It returns a pretty string.
Include it to your doc
<script src="prettyDate.min.js"></script>
Then simply prettify your javascript dates
prettyDate(new Date()); // --> "Just now"
prettyDate("1979-08-31"); // --> "Aug 31st 1979"
Here are some examples of output.
It’s Beerware.