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

world-clockify

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

world-clockify

world-clockify is a utility package that handles complex timezone-based date operations.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-63.16%
Maintainers
0
Weekly downloads
 
Created
Source

World-Clockify

Node.js CI GitHub license

Features

  • Convert date/time between different timezones. (e.g. Asia/Kolkata).
  • Get the current time in any timezone. (e.g., Asia/Kolkata)
  • Calculate the time difference (in hours) between two timezones. (e.g., 'America/New_York', 'Europe/London');
  • Supports both JavaScript and TypeScript

Installation

You can install the package via npm or yarn.

# npm
npm install world-clockify

# yarn
yarn add world-clockify

Usage

After installation, you can use the library as follows:

import { convertTimeZone, getCurrentTimeInZone, getTimeDifference, formatDateInTimeZone } from 'world-clockify';

// Convert time between timezones
const convertedTime = convertTimeZone('2024-01-01T12:00:00', 'America/New_York', 'Europe/London');
console.log(convertedTime); // Outputs: '2024-01-01T17:00:00.000Z'

// Get current time in a specific timezone
const currentTime = getCurrentTimeInZone('America/New_York');
console.log(currentTime); // Outputs the current time in ISO format

// Calculate time difference between two timezones
const timeDifference = getTimeDifference('America/New_York', 'Europe/London');
console.log(timeDifference); // Outputs: 5 (hours)

const dateStr = '2024-10-14T12:00:00';
const fromZone = 'UTC';
const toZone = 'America/New_York';
const format = 'MM/dd/yyyy HH:mm';

// Example usage:
console.log(formatDateInTimeZone(dateStr, fromZone, toZone, format)); //output: 10/14/2024 08:00

Keywords

FAQs

Package last updated on 14 Oct 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