Problem with Date and $.ajax

Problem with Date and $.ajax

Hi all,

First I would like to thank the jQuery team for this new release! It looks extremely promising.

Btw, I just updated a test page to jQuery 1.4 and now I am getting the following error:

"this.toDateString" is not a function

when a Date object is created within the scope of an $.ajax call

The error is generated by the following:

   
  1.  Date.prototype.shortDayMonth=function(sep){ var str=this.toDateString().split(" "); sep=sep||" "; return str[2] + sep + str[1]; }
In that case "this", inside Date.prototype, is the "window" object (hence the error message).

The error occurs (so far) only when jQuery needs to create a Date object within the $.ajax function (i.e. parsing the response if dataType=json or when you put some Dates in the request data object attributes).