There’s a preview of the content on Vimeo here: Backbone.js Quickly – Preview.
XDate (GitHub: arshaw / xdate, License: dual MIT and GPL) by Adam Shaw is a wrapper around
Date that provides improved date parsing, formatting, and manipulation. XDate format strings really help with formatting dates, which I find myself doing a lot lately in Node or single page applications.
Here’s an example of XDate’s formatting method:
new XDate(2011, 0, 1, 6, 0).toString('d/M/yy h(:mm)TT');
Another useful feature of this library is the set of XDate diffing methods. They provide a friendly API around date subtraction.
Most of XDate’s methods return an
XDate, so it’s chainable too:
d1 = new XDate(); d2 = d1.clone() .setUTCMode(true) .setDate(1) .addMonths(1) .addYears(2);
- How BigIntegers Work, part 1: Storage, Addition, and Subtraction
- How BigIntegers Work, part 2: Multiplication
If you look at the source, you’ll probably notice that I’m actually using base 10000000, not base 10. I’m using decimal in these examples because it makes things clearer but everything works pretty much exactly the same way in any base. Using a larger base just makes things more efficient because you get 7 digits in each array entry.
Matthew created this library to support his Google Chrome Scientific Calculator.