Date javascript object from IE cannot be automatically bound to Datetime in ASP.NET MVC

Posted by Sergio on Stack Overflow See other posts from Stack Overflow or by Sergio
Published on 2011-01-14T11:12:12Z Indexed on 2011/01/14 11:53 UTC
Read the original article Hit count: 277

Filed under:
|
|
|

Hi There,

I have a site that uses a jquery calendar to display events. I have noticed than when using the system from within IE (all versions) ASP.NET MVC will fail to bind the datetime to the action that send back the correct events.

The sequence of events goes as follows.

  • Calendar posts to server to get events
  • Server ActionMethod accepts start and end date, automatically bound to datetime objects

In every browser other than IE the start and end date come through as:

Mon, 10 Jan 2011 00:00:00 GMT

When IE posts the date, it comes through as

Mon, 10 Jan 2011 00:00:00 UTC

ASP.NET MVC 2 will then fail to automatically bind this to the action method parameter.

Is there a reason why this is happening? The code that posts to the server is as follows:

data: function (start, end, callback) {
        $.post('/tracker/GetTrackerEvents', { start: start.toUTCString(), end: end.toUTCString() }, function (result) { callback(result); });
    },

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET