get client time zone from browser
Look at this repository pageloom it is helpful
download jstz.min.js and add a function to your html page
<script language="javascript">
function getTimezoneName() {
timezone = jstz.determine()
return timezone.name();
}
</script>
and call this function from your display tag
Half a decade later we have a built-in way for it! For modern browsers I would use:
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(tz);
This returns a IANA timezone string, but not the offset. Learn more at the MDN reference.
Compatibility table - as of March 2019, works for 90% of the browsers in use globally. Doesn't work on Internet Explorer.