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

@jexop/date-time

v1.2.4

Published

Date and time operators for the JSON Expression Operators library. This package provides operators for evaluating date and time-based expressions, powered by [luxon](https://www.npmjs.com/package/luxon).

Downloads

807

Readme

Date-Time Operators

Date and time operators for the JSON Expression Operators library. This package provides operators for evaluating date and time-based expressions, powered by luxon.

Installation

npm install @jexop/date-time
# or
pnpm add @jexop/date-time

Basic Usage

First, import the dateTimeOperators and add them to the registry:

import { evaluate, registry } from '@jexop/core';
import { dateTimeOperators } from '@jexop/date-time';

// register date-time operators
registry.add(dateTimeOperators);

Now you can use date and time operators in your expressions:

const expression = {
  op: 'age',
  timestamp: '2024-01-15',
};

const result = evaluate(expression);
// result will be a Duration representing the time elapsed since 2024-01-15

Operators

The @jexop/date-time package provides date and time-related operators. These operators allow you to work with timestamps, calculate durations, and compare dates relative to the current time.

For a complete list of operators and their usage, see src/README.md.

More Information

For more information about JSON Expression Operators and other operator packages, visit the @jexop/core package.

Additional operator packages:

Date-Time Operators

Available Operators

now

Returns the current date and time in UTC.

| Property | Description | | -------- | ----------- | | (none) | No parameters |

Example:

{
  "op": "now"
}

age

Calculates the duration from a given timestamp to now.

| Property | Description | | ----------- | ---------------------------------------------- | | timestamp | Date/time value (string, number, or DateTime) |

Example:

{
  "op": "age",
  "timestamp": "2024-01-15T10:30:00"
}

start-of & end-of

Returns the start or end of a time period relative to now.

| Property | Description | | -------- | ------------------------------------------------------- | | unit | Time unit: hour, day, week, month, or year |

Example:

{
  "op": "start-of",
  "unit": "day"
}

Age Comparison Operators

Compare a timestamp against a relative time offset from now.

before-past

Check if a timestamp is before a duration in the past.

| Property | Description | | ----------- | ---------------------------------------------- | | timestamp | Date/time value (string, number, or DateTime) | | duration | Duration value (string, number, or object) |

after-past

Check if a timestamp is after a duration in the past.

| Property | Description | | ----------- | ---------------------------------------------- | | timestamp | Date/time value (string, number, or DateTime) | | duration | Duration value (string, number, or object) |

before-future

Check if a timestamp is before a duration in the future.

| Property | Description | | ----------- | ---------------------------------------------- | | timestamp | Date/time value (string, number, or DateTime) | | duration | Duration value (string, number, or object) |

after-future

Check if a timestamp is after a duration in the future.

| Property | Description | | ----------- | ---------------------------------------------- | | timestamp | Date/time value (string, number, or DateTime) | | duration | Duration value (string, number, or object) |

Example:

{
  "op": "before-past",
  "timestamp": "2024-06-15",
  "duration": "30 days"
}

to-duration

Converts a value to a Duration object.

| Property | Description | | -------- | --------------------------------------- | | (value) | Value to convert to Duration (string or object) |

Example:

{
  "op": "to-duration",
  "value": "2 weeks"
}