title: Interpret (NOT convert!) Date in other timezone in JavaScript/moment
body: <p>This question seems similar to <a href="https://stackoverflow.com/questions/29870991/deprecation-warning-moment-construction-falls-back-to-js-date">Deprecation warning: moment construction falls back to js Date</a>, as the same warning appears. However, that warning is not the focus of this question, and the solution described is not well suited for my use case. I've edited the appropriate passages below to explain why this is so.</p>
  
  <p>Consider a web application where the user can select a time range of images made by a stationary camera.
  Obviously, this camera may not be in his own timezone.
  Add to that that the REST-API delivering the images does everything in UTC.</p>
  
  <p>I am using angular4, moment.js and moment timezone.</p>
  
  <p>So he can choose whether he wants to see the images with timestamps in his local timezone, the timezone the camera is in, or in UTC. So far so well, everything is working up to this point.</p>
  
  <p>Where I get in trouble is when setting the time range. Obviously, the start, and end times the user sets should be interpreted as being in the timezone he has selected for display, so I can convert them to UTC before sending the request to the server.
  The Date object I get from the date picker (primeng calendar in this case, but that doesn't really matter) is of course in browser local time.</p>
  
  <p>So what I need to be able to do is take that Date and interpret it in the timezone of the camera, as is, without converting it. So if the user sets "from 10:00 to 17:00" while sitting in timezone UTC -2, and the camera is located in UTC + 2, I need to get "10:00 to 17:00 in UTC +2", NOT "14:00 to 21:00 in UTC +2".</p>
  
  <p>I tried several approaches, some of which even work, but each seems to have their own caveats, and they're all butt-ugly because they do unnecessary string conversions. For example:</p>
  
  <pre><code>moment.tz(date.toLocaleString, cameraTimezone)
  </code></pre>
  
  <p>This works, but throws a deprecation warning:</p>
  
  <blockquote>
    <p><em>value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js <code>Date()</code>, which is not reliable across all browsers and versions.</em></p>
  </blockquote>
  
  <p>I could get rid of that warning by specifying what format the passed date string is in, but I'm facing the problem that neither toLocaleString() nor toString() are consistent. toLocaleString() will obviously give me another format depending on the locale, and toString() yields different results in different browsers, so how would I know what I get?</p>
  
  <p>So I try with a proper format, but if I use <code>Date::toIsoString</code> directly, the moment I get has been converted to UTC, which is not what I need either: </p>
  
  <pre><code>let datestring = date.toISOString();   //datestring will be in utc
  const mom = moment.tz(datestring, cameraTimezone);  //moment will therefore be the wrong time.
  </code></pre>
  
  <p>There's the obvious way of creating a string of the Date object myself (which is really ugly in javascript) and then parsing it into the moment by specifying that format. But all of these string conversions feel more like a hack than a proper solution, and I'd really like to get rid of them altogether and just tell moment "Here you have a date, it's supposed to be in this timezone, even if it says it isn't". Is there a way to do that?</p>