title: Remove seconds from toLocaleTimeString
body: <p>The <code>Date.prototype.toLocaleTimeString()</code> method returns a string with a language sensitive representation of the time portion of this date. It is available for modern browsers.</p>
  
  <p>Unfortunately, the native function <strong>is not able</strong> to prevent the <strong>output of seconds</strong>. By default, it outputs a time format like <code>hh:mm:ss</code> or <code>hh:mm AM/PM</code> etc.</p>
  
  <blockquote>
    <p><strong>second</strong>: The representation of the second. Possible values are "<code>numeric</code>", "<code>2-digit</code>".</p>
  </blockquote>
  
  <p>Source: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString" rel="noreferrer">MDN reference</a></p>
  
  <p>This means, that you can not use something like <code>{second: false}</code>.</p>
  
  <hr>
  
  <p>I'm looking for a <em>simple stupid</em> solution, to <strong>remove the seconds</strong> from a <code>hh:mm:ss</code> formatted string.</p>
  
  <pre><code>var date = new Date();
  var time = date.toLocaleTimeString(navigator.language, {hour: '2-digit', minute:'2-digit'});
  console.log(time); // 15:24:07
  </code></pre>
  
  <p>This regular expressions <strong>don't</strong> work:</p>
  
  <pre><code>time.replace(/:\d\d( |$)/,'');
  time.replace(/(\d{2}:\d{2})(?::\d{2})?(?:am|pm)?/);
  </code></pre>