Blog

JavaScript – Date Difference Function

A few months ago I wrote a blog post about extensions to the Date.prototype. That post provided ways to add date parts and subtract date parts. Today’s post shows you how to use a generic Date.prototype.diff() function to find the difference between two dates and optionally return a string specifying Read more…

By Chris West, ago
Blog

JavaScript – Date.prototype.toISOString()

As of JavaScript 1.8, a new prototypal function for the Date objects has been added: toISOString(). Ordinarily this returns a string similar to the following: 2012-10-1T21:43:54.803Z The problem is that not all browsers support JavaScript 1.8 yet. For this reason, if you want to use this function regardless of the Read more…

By Chris West, ago
Blog

JavaScript – Date.prototype.format()

Sometimes you write code that you wish you could totally rework. That is how I feel about jPaq’s Date.prototype.format(). The real issue I have with it is that the metacharacters are not intuitive. Therefore, I decided to write a new version of this function which is more intuitive. The following Read more…

By Chris West, ago