0

I am trying to access the start property of an event object and I am seeing some strange behavior, here is the relevant code:

console.log(event);
console.log(event.start);

And here is the output:

enter image description here

Why am I getting different values for the start property? I want the 9:31, but it's returning 8:26, what's going on here?

And why dont the values match between the Object Details header, and the expanded view?

Here is the returned string when I console.log(JSON.stringify(event));:

{"id":"1","title":"Meeting Test","start":"2013-12-30T16:26:00.000Z","reminder":"2013-12-30 13:58:32","source":{"url":"../someURl/somePhp.php","dataType":"json","type":"POST","data":{"action":"fetch","offset":480},"className":[]},"_id":"1","_start":"2013-12-30T16:26:00.000Z","end":null,"_end":null,"allDay":false,"className":[]}
A.O.
  • 3,733
  • 6
  • 30
  • 49
  • Can you show your json? – Alex Shilman Jan 02 '14 at 22:19
  • @AlexShilman you want the stringified version of the event object? – A.O. Jan 02 '14 at 22:20
  • Yes. The part that you're trying to get. – Alex Shilman Jan 02 '14 at 22:21
  • 1
    Did something modify the `event` object after its `start` property was logged? – Bergi Jan 02 '14 at 22:22
  • @Bergi I think you have found the culprit, I was unaware of this behavior! – A.O. Jan 02 '14 at 22:26
  • But this is not an array. – Alex Shilman Jan 02 '14 at 22:30
  • @AlexShilman you're right it's not an array, but the issue lies in Chromes Console, the event object was indeed being modified directly after the console.log and those are the values that we see in the expanded view. I consider it a bug, it is very misleading, good to know tho! – A.O. Jan 02 '14 at 22:38
  • 1
    @AlexShilman: Check the many linked questions and duplicates of that post. The behaviour is similar for arrays as it is for objects. If you find a more canonical answer in another post, I'd be happy to close future duplicates with that. – Bergi Jan 02 '14 at 23:56

0 Answers0