TimeSpan.js Version 1.2 released
I've just pushed a new Version of my TimeSpan Library to GitHub. Version 1.2 contains a new "static" constructor TimeSpan.FromDates which takes two dates and returns the difference between them as a TimeSpan. If the second date is earlier than the first date, the TimeSpan will be negative. Pass true as third parameter to force it to be positive.
Usage example:
var date1 = new Date(2010, 3, 1, 10, 10, 5, 0); var date2 = new Date(2010, 3, 1, 10, 10, 10, 0); var ts = TimeSpan.FromDates(date2, date1); var ts2 = TimeSpan.FromDates(date2, date1, true); alert(ts.totalSeconds()); // -5, because we put the later date first alert(ts2.totalSeconds()); // 5, because we passed true as third parameter