function getTimezoneOffset(timeZone) {
    const now = new Date();
    const tzString = now.toLocaleString("en-US", {
        timeZone,
    });
    const localString = now.toLocaleString("en-US");
    const diff = (Date.parse(localString) - Date.parse(tzString)) / 3600000;
    const offset = diff + now.getTimezoneOffset() / 60;
    return -offset;
}
Returns the offset from UTC in hours for the current locale.
@param {string} timeZone Timezone to get offset for
@returns {number} The offset from UTC in hours.

Generated by Trelent