I am using the following code to get a datetime at a specified time zone. The date and time is returned correctly except for the the time zone offset.
Ex: in the below snippet it returns time zone offset (GMT+2) instead of the desired one (GMT+5 at New Delhi)
How to fix it to return the same offset as the specified time zone?
const options = {
dateStyle: "long",
timeStyle: "long",
};
const dateTimeAtNewDelhi = new Date(new Date().toLocaleString("en-US", {timeZone: "Asia/Kolkata" }))
document.querySelector('#timezone-date-time').innerHTML = dateTimeAtNewDelhi.toLocaleString("en-US", options);
#timezone-date-time{
font-size:1.5em;
margin:auto;
}
<div id="timezone-date-time">
</div>