Problem with date.js and datepicker.js

Problem with date.js and datepicker.js


I'm using Kelvin Luck's DatePicker plugin (v2) found here:
http://kelvinluck.com/assets/jquery/datePicker/
I've used v1 before and this is the first time using v2.
To use it, you need to also use a few of the UI plugins, including date.js
I'm having an issue in IE browsers. If I select the link to open the
calendar, and then click a date on the calendar, I get this error in
IE and ONLY in IE (6 or 7):
---------------------------
Error
---------------------------
A Runtime Error has occurred.
Do you wish to Debug?
Line: 139
Error: 'length' is null or not an object
---------------------------
Yes No
---------------------------
As usual, IE's line number is never accurate. But, after some trial
and error, I think I've narrowed the problem down to the utility
method in date.js:
    // utility method
    var _zeroPad = function(num) {
        var s = '0'+num;
        return s.substring(s.length-2)
        //return ('0'+num).substring(-2); // doesn't work on IE :(
    };
lo and behold, there's an actual comment there that point out that at
least some aspect of it it doesn't work in IE, though I'm not quite
sure what it means.
It appears this function is called at least twice from the onclick event.
If I include an alert(s.substring(s.length-2)); line, it returns the
value of the month first (such as '04') and then the value of the day
(such as '22'). In that example, I'm picking 4/22/2008. After alerting
me with those two values, it then errors out with the error above.
Has anyone run into this, have any idea why it's happening, or have an
way to hack around the problem?
FYI, I'm using jquery-1.2.4a.js
-Darrel