My application receives a "dateT
time±
timezone" from the API. I'm supposed to show that exact time while formatted with the user defined preference:
var userFormat = "en-US"
var original = "2020-09-01T12:14:05.663-01:23" // strange timezone only to make a point
var date = new Date(original)
console.log(date.toLocaleString(userFormat, {
hour12: false ,
hour : "numeric",
minute: "numeric",
second: "numeric"}))
// expected: "12:14:05"
How can I get a string with the original 12:14:05
, not the local time or the GMT time while avoiding string manipulation?