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

sai-utc-to-ist-time

v1.0.0

Published

A lightweight JavaScript utility to convert UTC time to IST (Indian Standard Time) and vice versa

Readme

utc-to-ist

A lightweight JavaScript utility to convert UTC time to IST (Indian Standard Time) and vice versa. No dependencies, works in both Node.js and browser environments.

npm version License: MIT

Features

  • 🚀 Zero dependencies
  • 📦 Lightweight (~1KB)
  • 🔄 Bidirectional conversion (UTC ↔ IST)
  • 🎯 Simple and intuitive API
  • 💪 TypeScript support
  • 🌐 Works in Node.js and browsers

Installation

npm install utc-to-ist

Usage

Basic Usage

const { utcToIst, istToUtc, formatIst } = require("utc-to-ist");

// Convert current UTC time to IST
const istTime = utcToIst();
console.log(istTime); // Date object in IST

// Convert specific UTC time to IST
const specificIstTime = utcToIst("2026-01-28T10:00:00Z");
console.log(specificIstTime); // 2026-01-28T15:30:00.000Z (IST)

// Convert IST to UTC
const utcTime = istToUtc("2026-01-28T15:30:00");
console.log(utcTime); // 2026-01-28T10:00:00.000Z (UTC)

// Get formatted IST string
const formatted = formatIst("2026-01-28T10:00:00Z");
console.log(formatted); // "2026-01-28 15:30:00"

ES6 Module

import { utcToIst, istToUtc, formatIst } from "utc-to-ist";

const istTime = utcToIst();

Browser Usage

<script src="node_modules/utc-to-ist/index.js"></script>
<script>
  // Functions are available globally on the window object
  console.log(formatIst());
  console.log(utcToIst());
  console.log(istToUtc());
</script>

API Reference

utcToIst(date?)

Converts UTC time to IST (adds 5 hours 30 minutes).

Parameters:

  • date (optional): Date object, date string, or timestamp. Defaults to current time.

Returns: Date object representing the IST time.

Example:

utcToIst(); // Current time in IST
utcToIst("2026-01-28T10:00:00Z"); // Specific UTC time to IST
utcToIst(new Date()); // Date object to IST
utcToIst(1706437200000); // Timestamp to IST

istToUtc(date?)

Converts IST time to UTC (subtracts 5 hours 30 minutes).

Parameters:

  • date (optional): Date object, date string, or timestamp. Defaults to current time.

Returns: Date object representing the UTC time.

Example:

istToUtc(); // Current time in UTC
istToUtc("2026-01-28T15:30:00"); // Specific IST time to UTC
istToUtc(new Date()); // Date object to UTC

formatIst(date?)

Converts UTC time to IST and returns a formatted string.

Parameters:

  • date (optional): Date object, date string, or timestamp. Defaults to current time.

Returns: String in format YYYY-MM-DD HH:MM:SS (IST).

Example:

formatIst(); // "2026-01-28 15:30:00"
formatIst("2026-01-28T10:00:00Z"); // "2026-01-28 15:30:00"

TypeScript Support

This package includes TypeScript definitions:

import { utcToIst, istToUtc, formatIst } from "utc-to-ist";

const istTime: Date = utcToIst();
const utcTime: Date = istToUtc();
const formatted: string = formatIst();

How It Works

IST (Indian Standard Time) is UTC+5:30. This package:

  • UTC to IST: Adds 5 hours and 30 minutes (19,800,000 milliseconds)
  • IST to UTC: Subtracts 5 hours and 30 minutes (19,800,000 milliseconds)

Use Cases

  • Converting server timestamps (UTC) to Indian local time
  • Displaying IST time in web applications
  • Logging events in IST timezone
  • Scheduling tasks based on IST
  • Converting user input from IST to UTC for storage

License

MIT © Sai

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you find any bugs or have feature requests, please create an issue on GitHub.

Changelog

1.0.0

  • Initial release
  • UTC to IST conversion
  • IST to UTC conversion
  • Formatted IST output