How can I gather the visitor's time zone information?
I need both:
- the time zone (for example, Europe/London)
- and the offset from UTC or GMT (for example, UTC+01)
How can I gather the visitor's time zone information?
I need both:
Using an offset to calculate Timezone is a wrong approach, and you will always encounter problems. Time zones and daylight saving rules may change on several occasions during a year, and It's difficult to keep up with changes.
To get the system's IANA timezone in JavaScript, you should use
console.log(Intl.DateTimeFormat().resolvedOptions().timeZone)