title: Preventing Date transformation in the browser?
body: <p>I'm getting a date range from the input fields (dd/mm/yyyy HH:MM:ss) which I would like to keep it exactly as received, without letting the browser convert it to local timezone. How can I do this?</p>
  
  <p>I've tried using a function to convert the date in a different readable format but still, the browser is changing the date.</p>
  
  <pre><code>&lt;input type='datetime-local' class="form-control" step="1" id="startRange" /&gt;
  &lt;input type='datetime-local' class="form-control" step="1" id="endRange" /&gt;
  
  let datePickStart = new Date(document.getElementById("startRange").value);
  let datePickEnd = new Date(document.getElementById("endRange").value);
  console.log(datePickStart);
  console.log(datePickEnd);
  
  
  let startRangeDate = dateConvert(datePickStart);
  let endRangeDate = dateConvert(datePickEnd);
  console.log(startRangeDate);
  console.log(endRangeDate);
  
  function appendLeadingZeroes(n) {
      if (n &lt;= 9) {
          return "0" + n;
      }
      return n
  }
  
  function dateConvert(dateToConvert) {
  
      let dateString = dateToConvert.getFullYear() + "-" + appendLeadingZeroes(dateToConvert.getMonth() + 1) + "-" + appendLeadingZeroes(dateToConvert.getDate());
      let timeString = appendLeadingZeroes(dateToConvert.getHours()) + ":" + appendLeadingZeroes(dateToConvert.getMinutes()) + ":" + appendLeadingZeroes(dateToConvert.getSeconds());
      // Prevent conversion of date in the browser?
      let dateFiltered = dateString + "T" + timeString;
      return dateFiltered;
  }
  </code></pre>
  
  <p>I'm expecting the date received from input to remain exactly the same, without being changed by the browser to local timezone. Here's a <a href="https://jsfiddle.net/q32kydfx/9/" rel="nofollow noreferrer">JSFiddle I did:</a></p>