toLocaleTimeString() always showing leading zero

I would like to display this as something like: 4:26 PM.

But what I keep getting is: 04:26 PM.

If I remove the hour and minute options from toLocaleTimeString(), it works, but it also displays seconds, which I don't want.

function myClock() { 
    var d = new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});   
    document.getElementById("clock").innerHTML = d; 
setInterval(myClock, 1000);
<div id="clock"></div>
<script src="testStorage.js"></script>

Read more here:

Content Attribution

This content was originally published by scott.schaffer at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: