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

usa-bank-working-day

v1.0.1

Published

calculate U.S.A government bank working day without outer dependencies

Readme

USA Bank Working Day

Toolkit for checking whether a given calendar date is a U.S. federal bank holiday (weekends included) and for computing related working-day helpers.

  • Input date format: "yyyy-mm-dd" or "yyyy-m-d"
  • Holiday source: https://www.federalreserve.gov/aboutthefed/k8.htm

Install

# Bun (preferred)
bun add usa-bank-working-day

# npm
npm i usa-bank-working-day

Usage

All APIs accept either a Date or a date string. When a method returns a date, it returns a Date object (constructed at local noon to avoid DST/midnight edge cases).

import toolkit, {
  UsaBankWorkingDayToolKit,
  createUsaBankWorkingDayToolKit,
} from "usa-bank-working-day";

const toYMD = (d: Date) => `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;

toolkit.isBankHoliday("2020-7-3"); // true

toYMD(toolkit.getLastWorkingDate("2018-1-2")); // "2017-12-29"

toYMD(toolkit.fixedDateHolidayAdjust("2020-7-4")); // "2020-7-3" (observed)

// Prefer a fresh instance if you want isolated configuration/cache:
const isolated = createUsaBankWorkingDayToolKit();
const alsoIsolated = new UsaBankWorkingDayToolKit();

CommonJS

const toolkit = require("usa-bank-working-day");

toolkit.isBankHoliday("2022-01-17");

// Named exports are attached onto the default export for CJS:
const { UsaBankWorkingDayToolKit, createUsaBankWorkingDayToolKit } = toolkit;

API Notes

  • isBankHoliday(date) returns true for weekends (Sat/Sun) and observed federal holidays.
  • fixedDateHolidayAdjust(date) applies observation rules: Sunday -> Monday, Saturday -> Friday.
  • getDateOfOrdinalHoliday(date, holiday) / getDateOfFixedDateHoliday(date, holiday) use a "target year" from the first argument.
  • Months are 0-indexed (0 = January, 11 = December).
  • Historical applicability is modeled for holidays where it matters (e.g., Juneteenth is effective starting in 2021).
  • Special case: Dec 31 on a Friday is treated as a bank holiday (New Year's observed).

Development

# Install deps
bun install

# Run all tests
bun test

# Coverage
bun test --coverage

# Run a single test by name
bun test -t "isBankHoliday"

# Run a single test file
bun test test/main.test.ts

# Build (tsup -> dist/cjs + dist/esm)
bun run build

# Package + compatibility gates (npm pack + publint + arethetypeswrong + runtime smokes)
bun run check:package

Package / Exports Behavior

This package publishes both ESM and CJS via exports:

  • require("usa-bank-working-day") resolves to dist/cjs/index.cjs
  • import ... from "usa-bank-working-day" resolves to dist/esm/index.mjs

dist/cjs/index.cjs and dist/esm/index.mjs are small wrappers that:

  • preserve the historical default export shape (the default singleton toolkit instance)
  • expose modern named exports (UsaBankWorkingDayToolKit, createUsaBankWorkingDayToolKit) in both module systems

In CJS, those named exports are attached as properties on the default export; in ESM they are real named exports.

Migration Notes (Jest/Rollup -> Bun/tsup)

  • Tests: yarn test / npx jest ... -> bun test (and bun test -t "name")
  • Build: yarn rollup -> bun run build (tsup)
  • Packaging verification: use bun run check:package (runs npm pack, publint, and @arethetypeswrong/cli plus runtime smokes)

License

ISC