This would be my solution:
// For time zone: const timeZone = /\((.*)\)/.exec(new Date().toString())[1]; // Offset hours: const offsetHours = new Date().getTimezoneOffset() / 60; console.log(`${timeZone}, ${offsetHours}hrs`);
This would be my solution:
// For time zone: const timeZone = /\((.*)\)/.exec(new Date().toString())[1]; // Offset hours: const offsetHours = new Date().getTimezoneOffset() / 60; console.log(`${timeZone}, ${offsetHours}hrs`);