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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@garbee/iso8601

v1.0.3

Published

ISO 8601 validation aids

Downloads

15

Readme

ISO 8601 Validator

Iso8601 is a javascript library for validating and parsing ISO 8601 compliant date and datetime strings.

Installation

Direct Import

In runtimes such as Deno or in a native web script, the result can be imported from a distributed URL.

import {isValidDate} from 'https://unpkg.com/@garbee/iso8601@${version}/dist/index.js';

console.log(isValidDate('2000-01-01'));

NOTE: Remember to change the ${version} string to the package version you want to use.

NPM

To install using Node Package Manager execute the following command:

npm install @garbee/iso8601

Usage

The package exports a set of functions. Each can be individually imported.

isValidDate

Determines if the provided string is a valid full date string.

Returns: Boolean - True if valid, false if invalid.

import {
  isValidDate,
} from 'package';

const someVar = 'string';
if (isValidDate(someVar) === true) {
  // Parse and/or use string
}

isValidDateTime

Determines if the provided string is a valid full date and time string.

Returns: Boolean - True if valid, false if invalid.

import {
  isValidDateTime,
} from 'package';

const someVar = 'string';
if (isValidDateTime(someVar) === true) {
  // Parse and/or use string
}

parseDateString

Parses a date string into a structured object.

Returns: Object - Represents the properties of a date.

  • Year - Integer
  • Month - Integer. Starting at 1 for counting. Remember that JS Date beings month counting at 0.
  • Day - Integer
import {
  parseDateString,
} from 'package';

const data = parseDateString('2000-01-01');
console.log(data.year); // 2022 as an integer
console.log(data.month); // 1 as an integer for January.
console.log(data.day); // 1 as an integer

parseDateTimeString

Parses a date and time string into a structured object.

Returns: Object - Represents the properties of a date and time.

  • Year - Integer
  • Month - Integer. Starting at 1 for counting. Remember that JS Date beings month counting at 0.
  • Day - Integer
  • Hour - Integer
  • Minute - Integer
  • Second - Integer
  • Offset - String
import {
  parseDateTimeString,
} from 'package';

const data = parseDateTimeString('2022-02-03T17:07:44+04:00');
console.log(data.year); // 2022 as an integer
console.log(data.month); // 2 as an integer for February.
console.log(data.day); // 3 as an integer
console.log(data.hour); // 17 as an integer
console.log(data.minute); // 7 as an integer
console.log(data.second); // 44 as an integer
console.log(data.offset); // +04:00 as a string

Release Versioning

The core of the package's logic is a set of regex strings. Due to the potential for minor tweaks to cause issues with existing systems the versioning should reflect that.

Major revisions

Major version increments will be done any time the regex patterns are modified out of an abundance of caution.

Backwards incompatible API changes will require a major revision to attempt to align with Semver.

Minor revisions

Minor version increments will be used if new things are exposed. For any API changes that won't break existing usages. As well as for internal code changes that do not change input and output expectations.

Path revisions

Patch version increments will only be used for internal changes that don't affect the package results. For example deploying some documentation changes.

Notes

This package is only attempting to solve the higher 90% of logic for string formats. It is not attempting to be absolutely strict about complete time validity. For example:

  • 30th and 31st are valid even for shorter months
  • Any given time with 60 seconds is valid even though leap seconds is rarely valid.

If you are looking for an absolute time verification pattern that is not the scope or goal of this package. Primarily, it's just looking to make sure a string can be created into a JS Date without much issue.