I have been digging through the documentation on the Intl.DateTimeFormat() constructor to see if there is a way to do it and I am blurry-eyed trying to read through it. There are a gazillion options, but I don’t think that code will do output a truly custom format.
Does anyone else have any ideas on how to do this?
const timeVersion1 = {
timeZone: 'America/New_York', //use any time zone in the TZ database name column https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
hour12: false,
hour: '2-digit',
minute: '2-digit'
};
// store timezone result
const tzOne = new Date().toLocaleTimeString('en-US', timeVersion1);
// modify output
document.querySelector('.is--time-toronto').innerHTML = `// ${tzOne.slice(0, 2)}H${tzOne.slice(3,5)}`;