In the Calendar.prototype.parseDate function in
calendar.js, the date "09/04/2003" does not parse
properly with the format "dd/mm/y" or probably any
other format.
The reason is that the parseInt function being used is
not passing a radix as a second parameter so the 09
value is being interpreted as an octal value. The code
below is my modified snippet of the main loop that uses
the radix 10 to ensure we are using base 10 values:-
for (i = 0; i < a.length; ++i) {
if (b[i] == "D" || b[i] == "DD") {
continue;
}
if (b[i] == "d" || b[i] == "dd") {
d = parseInt(a[i], 10);
}
if (b[i] == "m" || b[i] == "mm") {
m = parseInt(a[i], 10) - 1;
}
if (b[i] == "y") {
y = parseInt(a[i], 10);
}
if (b[i] == "yy") {
y = parseInt(a[i], 10) + 1900;
}
if (b[i] == "M" || b[i] == "MM") {
for (j = 0; j < 12; ++j) {
if (Calendar._MN[j].substr(0,
a[i].length).toLowerCase() == a[i].toLowerCase()) { m =
j; break; }
}
}
}
This is from version 0.9.2.
Best Regards, Chris.
Logged In: NO
thank you chris. i was pulling my head with this bug.
Logged In: NO
Chris, I've found this bug, I've resolved it (at your same way)
and I wanted to signal it, but you've preceded me ;)
More information on parseInt bug:
http://www.breakingpar.com/bkp/home.nsf/Doc!
OpenNavigator&U=87256B280015193F87256C85006A6604
bye, Dario