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

temporals-nl

v0.0.2

Published

Natural-language date parsing extension for temporals.

Readme

temporals-nl

Natural-language date parsing — a separate extension that wraps temporals.

It lives outside the core on purpose: NL parsing is fuzzy, locale-heavy, and a fundamentally different concern from temporals' deterministic time generation. Keeping it here means the core stays lean and this can evolve (or be swapped for a heavier parser like chrono) independently.

Install

npm install temporals-nl
# On Node < 22, also:
npm install temporal-polyfill

Usage

import "temporal-polyfill/global"; // only on Node < 22
import { parseNatural } from "temporals-nl";

parseNatural("next monday");     // → Temporal.PlainDate
parseNatural("in 2 hours");      // → Temporal.ZonedDateTime
parseNatural("3 weeks ago");     // → Temporal.PlainDate
parseNatural("this year");       // → Temporal.PlainDate (uses temporals' startOf)
parseNatural("gibberish");       // → null

// Inject a reference clock — great for tests / deterministic parsing:
parseNatural("tomorrow", { now: Temporal.Now.zonedDateTimeISO("America/New_York") });

API

parseNatural(text, options?)

Parse a natural-language phrase into a Temporal value.

Returns a Temporal.PlainDate for date phrases, a Temporal.ZonedDateTime for time-relative phrases (and "now"), or null when the phrase isn't recognised.

options

| option | type | default | meaning | | --- | --- | --- | --- | | now | Temporal.ZonedDateTime | current instant | Reference "now"; inject for deterministic parsing/tests | | timeZone | string | system zone | IANA zone used only when now is omitted | | weekStart | "MO"…"SU" | "MO" | Week start for this <weekday> and this/next/last week |

A full, generated API reference lives at https://johnhenry.github.io/temporals-nl/ (npm run docs builds it locally).

Grammar

Case-insensitive; extra whitespace is tolerated.

| Pattern | Example | Result type | | --- | --- | --- | | today / tomorrow / yesterday | tomorrow | PlainDate | | now | now | ZonedDateTime | | next\|last\|this <weekday> | next monday | PlainDate | | bare <weekday> (next such day; today counts) | friday | PlainDate | | next\|last\|this week\|month\|year | last month | PlainDate | | in <n> <unit> / in a <unit> | in 3 days, in a week | date unit → PlainDate; time unit → ZonedDateTime | | <n> <unit> ago | 2 weeks ago | as above |

Units: minute hour day week month year (plus min/sec aliases). This is deliberately a starter grammar — extend the small rule set in index.mjs as needed.

Relationship to temporals

Depends on temporals (range 0.0.x) and uses its startOf for period boundaries. It needs no specific temporals feature beyond that, so it tracks patch releases automatically. It is not a replacement for temporals — it's a thin, opinionated convenience layer on top.

Develop

npm install        # temporals + temporal-polyfill from npm
npm test           # node:test suite
npm run examples   # run examples/*.mjs
npm run docs       # generate the TypeDoc API reference into docs/