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 🙏

© 2024 – Pkg Stats / Ryan Hefner

yold

v0.1.1

Published

A library for working with naive ISO8061 dates

Downloads

8

Readme

Yold

Yold is a zero-dependency library for working Naive ISO8061 dates. A naive date refers to a date representation that does not take into account time zones, daylight saving time, or any other specific time-related considerations. It simply represents a date without any additional information about the time or location.

Avoid issues with timezones being automatically added with new Date().

This library is designed for developers who need to work with ISO8061 date representations efficiently.

Install

To install Yold, use npm:

npm install yold

Usage

import { fromISODate, nextDay, toISOString } from 'yold';
// Parse an ISO8061 date string
const date = fromISODate("2024-07-22");
// Get the next day
const theNextDay = nextDay(date);
// Convert the date object back to an ISO8061 string
const iso = toISOString(theNextDay);
// Output the result
console.log(iso); // 2024-07-23

YOLD dates are ordered so you can use operators as you would with numbers

const d1 = fromISODate("2024-07-22");
const d2 = nextDay(d1);
console.log(d1 === d2);
console.log(d1 < d2); 
console.log(d1 > d2);

Why Yold

Yold stores date information by masking date components into a single number.

  • Year: 13-bit number - year values ranging from 1 to 9999.
  • Ordinal: 9-bit number - day values ranging from 1 to 366, accommodating leap years.
  • Leap Year: 1-bit number - if a year is a leap year
  • Day of the Week: 3-bit number - day of the week for the last day of the year before this year.