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

eonix

v1.3.2

Published

A modern date manipulation library for JavaScript and TypeScript

Readme

Eonix

A modern JavaScript date manipulation library that extends the native Date class with powerful utility methods for date calculations, timezone conversions, and difference calculations.

Features

  • Extends native Date class with additional functionality
  • Comprehensive date difference calculations
  • Timezone conversion utilities
  • Leap year handling
  • Week and day calculations
  • Date arithmetic operations
  • Full TypeScript support

Installation

npm install eonix

Usage

import Eonix from "eonix";

// Create a new Eonix instance
const date = new Eonix("2023-01-01");

// Add time to a date
date.add({ years: 1, months: 2, days: 3 });
console.log(date); // 2024-03-04

// Calculate difference between dates
const diff = Eonix.diff("2023-01-01", "2023-06-30");
console.log(diff.inMonths()); // 5
console.log(diff.inDays()); // 180

// Sort dates
const [earlier, later] = Eonix.sort("2023-06-30", "2023-01-01");

API Documentation

Static Methods

Eonix.sort(...dates)

Creates a sorted array of Eonix instances based on the given dates.

const [date1, date2] = Eonix.sort("2023-01-01", "2023-06-30");

Eonix.diff(start, end)

Calculates the difference between two dates.

const diff = Eonix.diff("2023-01-01", "2023-06-30");

Instance Methods

Date Arithmetic

  • add({ years, months, weeks, days, hours, minutes, seconds, milliseconds })
  • addDate({ years, months, weeks, days })
  • addTime({ hours, minutes, seconds, milliseconds })
  • addYears(years)
  • addMonths(months)
  • addWeeks(weeks)
  • addDays(days)
  • addHours(hours)
  • addMinutes(minutes)
  • addSeconds(seconds)
  • addMilliseconds(milliseconds)

Date Information

  • getWeekday() - Returns day of week (1-7)
  • getDayOfYear() - Returns day of year
  • getWeekNumber() - Returns week number
  • isLeapYear() - Checks if date is in a leap year
  • isUTC() - Checks if date is in UTC
  • inRange() - Checks if date is in date range

Timezone Operations

  • convertToUTC() - Converts date to UTC
  • convertToTimeZone(offset) - Converts to specified timezone offset
  • toDate() - Converts to native Date object

Diff Class Methods

Generic Difference Calculation

  • inUnits(units) - Calculates the difference between two dates in specified units
    const diff = Eonix.diff("2023-01-01", "2023-06-30");
    const result = diff.inUnits(["years", "months", "days"]);
    // Result: { years: 0, months: 5, days: 29 }
    Available units: "years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds" If no units are specified, all units will be calculated.

Difference Calculations

  • inYears({ absolute = false })
  • inMonths({ absolute = false })
  • inWeeks({ absolute = false })
  • inDays({ absolute = false })
  • inHours({ absolute = false })
  • inMinutes({ absolute = false })
  • inSeconds({ absolute = false })
  • inMilliseconds({ absolute = false })

Examples

Date Arithmetic

const date = new Eonix("2023-01-01");
date.add({ years: 1, months: 2, days: 3 });
// Result: 2024-03-04

Date Differences

const diff = Eonix.diff("2023-01-01", "2023-06-30");
console.log(diff.inMonths()); // 5
console.log(diff.inDays()); // 180

Timezone Conversion

const date = new Eonix("2023-01-01");
date.convertToTimeZone(2); // Convert to UTC+2

Leap Year Handling

const date = new Eonix("2020-02-29");
console.log(date.isLeapYear()); // true

Check if date is in date range

const date = new Eonix('2023-06-15');
const start = new Eonix('2023-06-01');
const end = new Eonix('2023-06-30');
console.log(date.inRange(start, end)); // true

License

MIT

Author