PDA

View Full Version : Error-Message: interval.toLowerCase is not a function caused by possible bug



TomToms
15 May 2009, 12:53 AM
Hi everybody,

I don't know, if this is a bug, but using something like



var dt = new Date('10/29/2006').add(Date.DAY, 5);
causes an error with Error-Message: interval.toLowerCase is not a function.

After deleting the toLowerCase the add-function works fine.
In ext-all-debug the error is at line 6232



switch(interval.toLowerCase()){...

Tom

Animal
15 May 2009, 1:23 AM
So if you even take a teensy peek under the hood, interval is what you are asking to add.

So somehow Date.DAY is not the string "d" which is should be.

What is it when you break at that line? Has some other code corrupted it?

TomToms
15 May 2009, 1:46 AM
Hi Animal,

thanks for the quick reply :)
I put the



var dt = new Date('10/29/2006').add(Date.DAY, 5);
directly into the Firebug-Console and break at line 6229 in ext-all-debug.

Interval is 86400000 (Milliseconds to a day), so Date.DAY becomes an integer and the toLowerCase fails...

I also tried Date.MONTH (result: 'mo') and Date.YEAR (result: 'y'), but Date.SECOND (result: 1000)...


Tom

Animal
15 May 2009, 3:07 AM
Have you got a global variable called "interval"?

Date.DAY "becomes" an integer? Probably not. But check it!

TomToms
15 May 2009, 3:30 AM
No, I haven't any variable called "interval".

With "becomes" an integer, I mean, that if I write Date.DAY into Firebug, the result is an integer (86400000). If I use a Date., which is timewise smaller than DAY, I always got an integer, if I use a Date., which is bigger than DAY, I got a string.

Animal
15 May 2009, 3:57 AM
Somewhere, your code is setting Date.DAY to the number of milliseconds in one day.