npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tzfinder

v1.0.3

Published

A library to find timezone name and offset from latitude/longitude using a bundled GeoJSON.

Downloads

16

Readme

Geo Timezone Lookup (tzfinder)

NPM version NPM downloads License: MIT GitHub issues GitHub stars

tzfinder is a Node.js library designed to determine the IANA timezone name (e.g., "America/New_York") and current UTC offset (e.g., "UTC-05:00") from geographic coordinates (latitude and longitude). It utilizes a bundled GeoJSON file containing timezone boundary data (derived from sources like Natural Earth) and leverages Turf.js for spatial analysis.

This package is ideal for server-side applications or build processes where you need to efficiently look up timezone information based on location without relying on external APIs for each lookup.

Key Features

  • Offline Lookup: Performs timezone lookups locally using a bundled GeoJSON data file.
  • IANA Timezone Name & UTC Offset: Returns both the descriptive timezone name and its current UTC offset.
  • Simple API: Easy to initialize and use with a straightforward getTimeOffsetAndName(lat, lon) method.
  • ES Module: Modern JavaScript module for easy integration.
  • Dependency on Turf.js: Uses the robust Turf.js library for point-in-polygon operations.

Prerequisites

  • Node.js (Version 14.x or higher recommended, as it uses ES Modules and modern JavaScript features).

Installation

Install the package using npm or yarn:

npm install tzfinder
# or
yarn add tzfinder

Usage

The library must be initialized before it can be used. Initialization involves fetching the timezones.geojson file. By default, it fetches this file from a CDN (jsDelivr) pointing to the version hosted in the package's GitHub repository.

import { TimezoneLookup } from 'tzfinder';

async function main() {
    const tzLookup = new TimezoneLookup();

    try {
        // Initialize the service.
        // By default, it fetches the GeoJSON from:
        // [https://cdn.jsdelivr.net/gh/metstudio/tzfinder@master/timezones.geojson](https://cdn.jsdelivr.net/gh/metstudio/tzfinder@master/timezones.geojson)
        // You can pass a custom URL if you host the GeoJSON elsewhere:
        // await tzLookup.initialize('YOUR_CUSTOM_GEOJSON_URL_HERE');
        await tzLookup.initialize(); 
        
        console.log("Timezone lookup service initialized successfully.");
        // Example coordinates for New York City
        const lat = 40.7128; // Latitude for New York City
        const lon = -74.0060; // Longitude for New York City
        const { timezoneName, utcOffset } = await tzLookup.getTimeOffsetAndName(lat, lon);
        console.log(`Timezone Name: ${timezoneName}`); // e.g., "America/New_York"
        console.log(`UTC Offset: ${utcOffset}`); // e.g., "UTC-05:00"

    } catch (error) {
        console.error("An error occurred:", error);
    }
}
main();