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

@ver0/now-ish

v0.0.0

Published

Parse relative time expressions like now-7d or now/w

Downloads

51

Readme

NPM Version NPM Downloads Dependents (via libraries.io), scoped npm package GitHub Actions Workflow Status NPM Type Definitions

Features

  • ✅ Human-readable time expressions
  • ✅ Custom units — define fiscal quarters, business days, or any domain-specific periods
  • ✅ Localization — support now in any language (jetzt, сейчас, ahora)
  • ✅ Timezone-aware operations
  • ✅ Works with any date library via adapters
  • ✅ Full TypeScript support

Why this package exists?

The expression syntax is simple enough that you can expose it directly to your users. Instead of building date pickers or dropdowns with predefined ranges, let users type now-7d for "last 7 days" or now/mo for "since start of month". It's readable, compact, and powerful enough for complex ranges like "start of next month" (now/mo+1mo/mo).

The syntax is compatible with Grafana's relative time expressions, so if you're building dashboards or analytics tools, your users may already be familiar with it.

The parser is fully extensible. You can define custom units like fiscal quarters (fq) or business days (bd) — whatever makes sense for your domain. You can also localize both the now keyword and unit names, enabling fully localized expressions: jetzt-7t in German, сейчас-7д in Russian. The grammar stays the same, but the vocabulary can be adapted to your audience.

How expressions work

Every expression starts with now — the current moment. From there, you can do two things:

Offset — move forward or backward in time by adding or subtracting a duration:

  • now-1d → one day ago
  • now+2w → two weeks from now
  • now-30m → thirty minutes ago

Round — snap to the beginning or end of a time period using /:

  • now/d → start of today (midnight)
  • now/w → start of this week (Monday midnight)
  • now/mo → first moment of this month

You can combine them. The expression is evaluated left to right:

  • now-7d/d → go back 7 days, then round to start of that day
  • now/w-1w → start of this week, then go back one more week
  • now/mo+1mo/mo → start of this month, add one month, round to start → first moment of next month

When rounding, you choose the direction:

  • round-down (default) → snaps to the start of the period
  • round-up → snaps to the end of the period (last nanosecond/millisecond)

This makes it easy to build time ranges: round-down gives you the "from" boundary, round-up gives you the "to" boundary.

Available Adapters

This is the core package — it parses expressions but doesn't know how to do actual date math. For that, you need an adapter that works with your preferred date library:

| Adapter | Returns | Install | | ------------------------------------------------------------------------------------------------------- | --------------- | -------------------------------------------------- | | @ver0/now-ish_date-fns | TZDate | npm install @ver0/now-ish_date-fns @ver0/now-ish | | @ver0/now-ish_temporal | ZonedDateTime | npm install @ver0/now-ish_temporal @ver0/now-ish |

Most users should install an adapter directly. The adapter provides a ready-to-use parse function:

import {parse} from '@ver0/now-ish_date-fns';

const startOfLastWeek = parse('now-1w/w');
const endOfToday = parse('now/d', 'round-up');

Building a custom adapter

If you need to support a different date library, the core package exports everything you need to build your own adapter. See the date-fns adapter source for a complete example.

import {createParser} from '@ver0/now-ish';

const parse = createParser({
	now: (ctx) => {},
	units: new Map(),
	timezone: 'UTC',
	nowAliases: ['now'],
});