get timezone offset javascript code example
Example 1: client timezone offset in JavaScript
var clientTimezoneOffset = new Date().getTimezoneOffset()/60;//offset in hours
Example 2: get browser timezone javascript
Intl.DateTimeFormat().resolvedOptions().timeZone
Example 3: get browser timezone
console.log(new Date().toTimeString().slice(9));
console.log(Intl.DateTimeFormat().resolvedOptions().timeZone);
console.log(new Date().getTimezoneOffset() / -60);