{"action":"created","issue":{"url":"https://api.github.com/repos/moment/moment/issues/2879","labels_url":"https://api.github.com/repos/moment/moment/issues/2879/labels{/name}","comments_url":"https://api.github.com/repos/moment/moment/issues/2879/comments","events_url":"https://api.github.com/repos/moment/moment/issues/2879/events","html_url":"https://github.com/moment/moment/issues/2879","id":125650167,"number":2879,"title":"Parsing ASP.NET JSON Dates (WCF format) is not working correctly.","user":{"login":"themakshter","id":2033876,"avatar_url":"https://avatars.githubusercontent.com/u/2033876?v=3","gravatar_id":"","url":"https://api.github.com/users/themakshter","html_url":"https://github.com/themakshter","followers_url":"https://api.github.com/users/themakshter/followers","following_url":"https://api.github.com/users/themakshter/following{/other_user}","gists_url":"https://api.github.com/users/themakshter/gists{/gist_id}","starred_url":"https://api.github.com/users/themakshter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/themakshter/subscriptions","organizations_url":"https://api.github.com/users/themakshter/orgs","repos_url":"https://api.github.com/users/themakshter/repos","events_url":"https://api.github.com/users/themakshter/events{/privacy}","received_events_url":"https://api.github.com/users/themakshter/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-01-08T17:03:11Z","updated_at":"2016-01-14T06:09:58Z","closed_at":"2016-01-09T14:54:22Z","body":"As mentioned in the Moment.js documentation [here](http://momentjs.com/docs/#/parsing/asp-net-json-date/), the parsing is supposed to work. However, there seems to be a problem with it. Using the example given there, \r\n```javascript\r\nmoment(\"/Date(1198908717056-0700)/\"); // 2007-12-28T23:11:57.056-07:00\r\n```\r\nThe time calculated should be `Fri Dec 28 2007 23:11:57 GMT+0000`. Instead, using \r\n```javascript\r\nmoment(\"/Date(1198908717056-0700)/\");\r\n```\r\ngive us `Sat Dec 29 2007 06:11:57 GMT+0000`. This is the same as callinng\r\n```javascript\r\nmoment(\"/Date(1198908717056)/\");\r\n```\r\nThis means, that the offset is not being parsed correctly and included in the calculation, which needs to be done so. This bug can easily be recreated using the console on this website. If you want to parse the WCF format correctly, the following snippet might be useful:\r\n```javascript\r\nDate.parseWcfDate = function(str) {\r\n  var regex = str.match(/\\/Date\\(([0-9]+)([-+])([0-9]+)\\)\\//);\r\n  var millisecs = parseInt(regex[1]);\r\n  var offset = parseFloat(regex[2] + regex[3]) / 100;\r\n  var utcMillsecs = millisecs + offset * 3600 * 1000;\r\n  return new Date(utcMillsecs);\r\n};\r\n```\r\n\r\nEDIT:\r\n\r\ncorresponding [jsfiddle](https://jsfiddle.net/themakshter/jpu6x5o6/) has been added.\r\n"},"comment":{"url":"https://api.github.com/repos/moment/moment/issues/comments/171540709","html_url":"https://github.com/moment/moment/issues/2879#issuecomment-171540709","issue_url":"https://api.github.com/repos/moment/moment/issues/2879","id":171540709,"user":{"login":"mj1856","id":1396388,"avatar_url":"https://avatars.githubusercontent.com/u/1396388?v=3","gravatar_id":"","url":"https://api.github.com/users/mj1856","html_url":"https://github.com/mj1856","followers_url":"https://api.github.com/users/mj1856/followers","following_url":"https://api.github.com/users/mj1856/following{/other_user}","gists_url":"https://api.github.com/users/mj1856/gists{/gist_id}","starred_url":"https://api.github.com/users/mj1856/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mj1856/subscriptions","organizations_url":"https://api.github.com/users/mj1856/orgs","repos_url":"https://api.github.com/users/mj1856/repos","events_url":"https://api.github.com/users/mj1856/events{/privacy}","received_events_url":"https://api.github.com/users/mj1856/received_events","type":"User","site_admin":false},"created_at":"2016-01-14T06:09:58Z","updated_at":"2016-01-14T06:09:58Z","body":"Yes."}}