title: node.js: version of dependency (moment-timezone) changes at runtime
body: <p>For the last day I researched a mysterious issue in which a <code>moment-timezone</code> feature would not work under particular, seemingly arbitrary circumstances. <strong>I discovered that the runtime version of my <code>moment-timezone</code> library was changing at some point from version 0.5.17 to 0.5.13.</strong></p>
  
  <p>Before adding more details, <strong>is this a <code>node.js</code> issue or a <code>moment-timezone</code> issue?</strong> </p>
  
  <p>The specific problem with <code>moment-timezone</code> I ended up resolving using <a href="https://yarnpkg.com/lang/en/docs/selective-version-resolutions/" rel="noreferrer" title="yarn selective version resolutions">yarn selective-version-resolutions</a>, but if this is a actually a <code>node.js</code> issue, I'm thinking more extreme measures are called for (<a href="https://yarnpkg.com/en/docs/cli/install#toc-yarn-install-flat" rel="noreferrer">yarn install --flat</a>?).</p>
  
  <p>I don't know which dependency was causing the version to change at runtime, but this was the relevant section from my <code>yarn.lock</code> file before adding the <code>resolutions</code> section:</p>
  
  <pre><code>moment-timezone@0.5.17:
    version "0.5.17"
    resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.17.tgz#3c8fef32051d84c3af174d91dc52977dcb0ad7e5"
    dependencies:
      moment "&gt;= 2.9.0"
  
  moment-timezone@^0.5.0, moment-timezone@^0.5.4, moment-timezone@~0.5.5:
    version "0.5.13"
    resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.13.tgz#99ce5c7d827262eb0f1f702044177f60745d7b90"
    dependencies:
      moment "&gt;= 2.9.0"
  </code></pre>
  
  <p>As you can see, my direct dependency was on version <strong>0.5.17</strong>, but the dependency of my other modules was getting resolved to version <strong>0.5.13</strong>. But I don't understand how at some point <strong>my</strong> dependency was getting resolved to <strong>0.5.13</strong>. </p>
  
  <p>To check the <code>moment-timezone</code> version I simply used <code>moment.tz.version</code>. That means that in my production code, the following code printed <strong>0.5.17</strong> until at some point suddenly printing <strong>0.5.13</strong>:</p>
  
  <pre><code>const moment = require('moment-timezone');
  console.log(`moment.tz.version: ${moment.tz.version}`);
  </code></pre>
  
  <p>One last detail: the moment-timezone function that was breaking when the version changed to <strong>0.5.13</strong> was the optional flag on the <code>moment.tz</code> function <a href="https://github.com/moment/moment-timezone/issues/440" rel="noreferrer">added in version 0.5.14</a>, in this code: </p>
  
  <p><code>moment(utcDateTime, format).clone().tz(timezone, true)</code></p>
  
  <p>Can anyone explain how this is possible? I hope it's a moment-timezone bug and not a node.js bug...</p>