Although I have forthcoming posts that involve 2D drawing with
dojox.gfx and rendering editable data with the really awesome
dojox.grid enhancements that are landing in version 1.2 of the toolkit coming up later in the month, I just rediscovered a “note to self” (for about the tenth time) suggesting that I should write a quick blurb on the dojo.date module; right now seems like a good time as any to go ahead and check that box.
Date objects sounds *so* boring, right? Well, yea, it is kind of boring. And tedious. And a customer is probably not going to pay you *just* to write them some
To acquaint you with the
Date object with the
dojo.date.stamp function and then calculating the time delta according to a unit of measurement, whether it be seconds, minutes, hours, or days with the help of the
Here, see for yourself:
There are a few more goodies in the
dojo.date module, including good support for formatting dates according to specific locales. Make the small investment in time now to save yourself from writing brittle code that you have to maintain yourself when these kinds of chores come up later.
And while it’s on your mind, be sure to pick up a copy of Dojo: The Definitive Guide for more battle-tested tips and techniques that can save you time.