JavaScript Time Zone Detect

1.0.7 · maintenance · verified Wed Apr 22

jstimezonedetect is a JavaScript library designed to determine the IANA time zone key (also known as the Olson time zone database) of the user's device. As of version 1.0.7, released in 2018, the project appears to be in maintenance mode with infrequent updates, and no active development is indicated for new time zone rule changes. Its primary utility lies in obtaining a standardized time zone identifier for server-side date and time normalization without requiring user interaction. A key differentiator is its specific scope: it focuses exclusively on *modern* time zones, typically from 2010 onwards, and intentionally disregards historical time zone data or geographical location-based detection. This targeted approach means it will not differentiate between time zones that share identical modern rules (e.g., Europe/Berlin and Europe/Stockholm if their current rules align) nor provide granular historical offsets.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to use jstimezonedetect in a Node.js environment to detect and log the client's IANA time zone name.

const jstz = require('jstimezonedetect');

try {
  const tz = jstz.determine();
  console.log('Detected IANA Time Zone:', tz.name());
} catch (error) {
  console.error('Error detecting time zone:', error.message);
}

view raw JSON →