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

@kensio/quando

v0.2.0

Published

Declarative temporal rules for schedules, deadlines, constraints, and exceptions

Downloads

422

Readme

Quando

Declarative temporal rules for schedules, deadlines, constraints, and exceptions.

Quando answers one question: given these rules about time, when does something happen? Temporal tells you what a moment is; Quando tells you when something occurs — "weekdays nine to five, except bank holidays", and then what that implies about now, about a window, and about three working hours from here.

npm install @kensio/quando

Requires a runtime with Temporal: Node 26 or later, or a browser that implements it. Quando reads the global rather than importing a polyfill, so it has no runtime dependencies; anywhere without Temporal natively can load temporal-polyfill first and everything here works untouched.

The rule language, builder, parser and queries below are on main and go out in the next release. 0.1.0 on npm carries only the interval core.

A rule

import { timeOfDay, weekdays } from "@kensio/quando";

const openingHours = weekdays().and(timeOfDay("09:00", "17:00"));

There is no build step to that: it is already the rule, a plain JSON-shaped object with methods hanging off it. JSON.stringify gives you a document you can store, and parseRule gives you the rule back.

Four questions

import { activeAt, advanceBy, elapsed, next } from "@kensio/quando";

const friday = Temporal.ZonedDateTime.from("2026-03-13T16:55[Europe/London]");

// Is it open?
activeAt(openingHours, friday);
// → true

// When does it next open?
next(openingHours, { from: friday.add({ hours: 2 }) })?.start?.toString();
// → 2026-03-16T09:00:00+00:00[Europe/London]

// How much opening is there this week?
elapsed(openingHours, {
  from: Temporal.ZonedDateTime.from("2026-03-09T00:00[Europe/London]"),
  to: Temporal.ZonedDateTime.from("2026-03-16T00:00[Europe/London]"),
}).toString();
// → PT40H

// Three hours of packing that only count while it is open — when is it done?
advanceBy(friday, Temporal.Duration.from({ hours: 3 }), {
  during: openingHours,
})?.toString();
// → 2026-03-16T11:55:00+00:00[Europe/London]

That last one is why the library exists, and it is the one that is genuinely awkward to do by hand.

Or say it the way you would say it

For opening hours and rotas there is a plainer front door, which builds the same thing:

import { rota, schedule, weekdays, weekends } from "@kensio/quando";

const openingHours = schedule()
  .open(weekdays(), "09:00-17:00")
  .closed("2026-12-25")
  .hoursOn("2026-03-11", "09:00-15:00"); // close early, just that day

openingHours.isOpen(friday);
// → true

const onCall = rota().assign(weekdays(), "alice").assign(weekends(), "bob");

onCall.whoIsOn(friday);
// → "alice"

Each line outranks the ones above it, so exceptions read in the order you would say them. See schedules and rotas.

Why intervals

A rule does not answer about an instant — it produces the intervals over which it holds. Anything that samples has to choose a step size, trading correctness against speed, and every derived question becomes the same loop. Producing intervals turns those loops into arithmetic: working time in a window is a sum, three working days from now is a walk, and a rule that can never be satisfied yields nothing instead of never finishing.

Concepts has the long version.

Documentation

quandojs.dev, which is built from docs/ in this repository:

  • Getting started — requirements, install, first query
  • Concepts — the model, and why it is that shape
  • Rules — every rule type, and what each produces
  • Queries — the four questions, and termination
  • Time zones — wall clock against elapsed time
  • Serialisation — the JSON form and its boundary
  • Schedules and rotas — opening hours and who is on, plainly
  • Cascades — layers carrying values, resolved by precedence
  • API — everything the package exports

What it is not

Not a date library — Temporal is that, and Quando is built on it. Not a scheduler: Quando calculates when and never fires anything, so its answer is your scheduler's input. Not storage, and not a holiday data provider; calendar data belongs in satellite packages so that the core carries none.

Cascades carry values by precedence; merging values that should add rather than displace is designed and not yet built, along with estimates and a command line.

Licence

Apache-2.0.