Thursday, August 4, 2011

ServerSide JavaScript Date Nonsense


I want to format some dates in my Express views.

First of all, my employer, i.TV, has a DateTime library that we wrote that is alright:

But I was hoping this would be something that's more in the view layer than than in the model/controller level.

Here are some libraries and functions that do some version of that:

However, none of them did what I wanted. Here is one that did:

This is what I did to make it work in my express views:


  1. Hey Jamund,
    Here's a modification to John's script that you might like:

    You can check out the tests to see if it meets your needs:

  2. I wrote a library for date modification called that does this same thing. I handles parsing, formatting, and timeago.

    It also handles i18n, so you can customize all the strings.

  3. @washwithcare. your library looks awesome too!

  4. This comment has been removed by a blog administrator.