title: Constructing an object with JS map results in some undefined keys. Why?
body: <p>Am I crazy?</p>
  
  <p>I have two functions:</p>
  
  <pre class="lang-js prettyprint-override"><code>export const timeblocks = (data) =&gt; {
    const res = data.map((d) =&gt; timeblock(d));
    console.log("tbs res[0].start", res[0].start);
    console.log("tbs res", res);
    return res;
  }
  
  export const timeblock = (data) =&gt; {
    const res = {
      id: data.id,
      start: moment(data.start),
      end: moment(data.end),
      duration: moment.duration(data.duration),
      timezone: data.timezone,
    };
    // return Object.freeze(res);
    console.log("tb res.start", res.start);
    console.log("tb res", res);
    return res;
  }
  </code></pre>
  
  <p>I'm passing data through like this: <code>timeblocks(sampleData)</code>:</p>
  
  <pre><code>sampleData = [
    {
      "id": 1010,
      "start": "2019-11-21T05:00:00Z",
      "end": "2019-11-21T05:30:00Z",
      "duration": "00:30:00",
      "timezone": "UTC"
    },
    {
      "id": 1052,
      "start": "2019-11-21T05:00:00Z",
      "end": "2019-11-21T06:00:00Z",
      "duration": "01:00:00",
      "timezone": "UTC"
    }
  ]
  </code></pre>
  
  <p>The <code>start</code> and <code>end</code> keys throw TypeError undefined in my React app.</p>
  
  <p><strong>However,</strong> I also get this:</p>
  
  <p><a href="https://i.stack.imgur.com/Doq5V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Doq5V.png" alt="Console log for data mapping in js"></a></p>
  
  <p>Object.freeze <strong>does</strong> work, but why are the values getting converted to undefined?</p>
  
  <p>I can't tell if this is a moment.js thing or a JS thing.</p>