Skip to content

ver0-project/now-ish

Repository files navigation

now-ish


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

Quick Start

Pick the adapter for your date library:

# date-fns users
npm install @ver0/now-ish_date-fns @ver0/now-ish

# Temporal API users
npm install @ver0/now-ish_temporal @ver0/now-ish
import {parse} from '@ver0/now-ish_date-fns';

const sevenDaysAgo = parse('now-7d');
const startOfToday = parse('now/d');
const endOfMonth = parse('now/mo', 'round-up');

Packages

Package Description
@ver0/now-ish Core parser — expression syntax, extensibility, types
@ver0/now-ish_date-fns date-fns adapter — returns TZDate
@ver0/now-ish_temporal Temporal API adapter — returns ZonedDateTime

Expression Syntax

now[/round][±Nunit[/round]]
  • now-7d → 7 days ago
  • now/d → start of today
  • now-7d/d → start of day, 7 days ago
  • now/mo+1mo/mo → start of next month

See the core package for the complete syntax guide.

License

MIT

About

Parse relative time expressions like now-7d or now/w – user-friendly syntax for dashboards and analytics. Grafana-compatible, fully extensible with custom units and localization. Adapters for date-fns and Temporal API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors