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

@lacspace/market-clock

v1.0.4

Published

Holiday-aware, timezone-correct trading clock — is NSE/BSE open now, next open/close, pre-open, holidays. Bring your own exchange spec. Zero-dependency.

Readme

@lacspace/market-clock

Is the market open right now? When does it next open or close? — a holiday-aware, timezone-correct trading clock.

npm version install size minzipped types license

Every trading app needs to answer "are we open?" correctly — accounting for weekends, holidays, pre-open sessions and the exchange's timezone. This does it in a few bytes. Ships with NSE / BSE presets (IST, no DST — so the offset is exact).

  • 🟢 isOpen() · isPreOpen() · status()"open" | "pre-open" | "closed"
  • ⏭️ nextOpen() · nextClose() · msToOpen() · msToClose()
  • 📅 Weekend + holiday aware · pre-open session support
  • 🏦 NSE / BSE presets, or bring your own ExchangeSpec
  • ⚡ Zero dependencies · 🌍 isomorphic · 📦 ESM + CJS · fully typed

Install

npm install @lacspace/market-clock      # or pnpm add / yarn add / bun add

Quick start

import { MarketClock, NSE } from "@lacspace/market-clock";

const nse = new MarketClock(NSE);

nse.isOpen();        // true / false, right now (IST-correct from any timezone)
nse.status();        // "open" | "pre-open" | "closed"
nse.isHoliday();     // is today an exchange holiday?

nse.nextOpen();      // Date — next session open
nse.nextClose();     // Date — next session close
nse.msToClose();     // ms remaining until close (0 if not open)

Build a live badge

const label = {
  open: "🟢 Market open",
  "pre-open": "🟡 Pre-open",
  closed: "🔴 Closed",
}[nse.status()];

if (nse.isOpen()) {
  const mins = Math.round(nse.msToClose() / 60000);
  console.log(`${label} · closes in ${mins} min`);
} else {
  console.log(`${label} · opens ${nse.nextOpen().toLocaleString()}`);
}

Custom exchange / your own holidays

import { MarketClock, NSE, createClock } from "@lacspace/market-clock";

// extend the built-in list
const nse = new MarketClock({ ...NSE, holidays: [...NSE.holidays, "2026-11-20"] });

// or a completely different exchange
const custom = createClock({
  name: "MyExchange",
  offsetMinutes: 0,              // minutes ahead of UTC (no-DST exchanges)
  preOpen: { open: "08:00", close: "08:15" },
  regular: { open: "08:15", close: "16:30" },
  weekend: [0, 6],              // Sun, Sat
  holidays: ["2026-12-25"],
});

ℹ️ Holiday lists follow the annual exchange circular and can shift year to year. The built-in NSE list covers nationally-fixed days reliably — verify and extend for full-year accuracy.

API

| Member | Returns | | --- | --- | | isOpen(at?) isPreOpen(at?) | boolean | | isHoliday(at?) isWeekend(at?) isTradingDay(at?) | boolean | | status(at?) | "open" \| "pre-open" \| "closed" | | nextOpen(from?) nextClose(from?) | Date | | msToOpen(at?) msToClose(at?) | number (ms) | | NSE BSE | ExchangeSpec presets |

The Lacspace StockKit

| Package | For | | --- | --- | | @lacspace/indicators | Technical indicators | | @lacspace/market | P&L, XIRR, brokerage & charges | | @lacspace/market-clock | Market hours & holidays (this package) | | @lacspace/paper-trade | Headless paper-trading engine |

Licensing

This package is free under the Lacspace Free Licence — MIT-equivalent freedoms. Use it in personal and commercial projects at no cost; just keep the notice.

Not every Lacspace package is free. We also offer Commercial (paid), Client-specific, and Private (proprietary) packages under separate terms. See the full Lacspace Licence Centre.


Part of the Lacspace ecosystem — 35 zero-dependency, isomorphic TypeScript packages.

All packages ↗ · npm org ↗ · Licence Centre ↗ · GitHub ↗