Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

worldtimeapi-lib

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

worldtimeapi-lib

Basic library for calling http://worldtimeapi.com programatically.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

world time API lib

This simple library exposes one function getTimezone, which will take care of everything the underlying API allows.

Preconditions

  • have Node.js LTS with npm installed. Library enforces using Node.js version 20.x or higher, due to internal usage of fetch function.

Usage

Get all timezones' areas

import { getTimezone } from "worldtimeapi-lib";

const [data, status] = await getTimezone();

if (status) {
  console.log(JSON.stringify(data));
}

Get specific area with its locations

const [data, status] = await getTimezone({ timezone: "Europe" });

Get specific location data of the area timezone

const [data, status] = await getTimezone({ timezone: "Europe/Prague" });

Get data for IP address

IP address is not provided
import { getIpAddress } from "worldtimeapi-lib";

const [data, status] = await getIpAddress();

if (status) {
  console.log(JSON.stringify(data));
}
IP address explicitly provided
const [data, status] = await getIpAddress({ ip: "8.8.8.8" });

Keywords

FAQs

Package last updated on 11 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc