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

sarieldatelib

v1.0.0

Published

A wrapper for the Javascipt Date Object

Readme

DateLib

A wrapper for the Javascipt Date Object

Definition Parameters

CustomDate can be created the same way as a Javascript Date object. You can define it with date parameters, or with no parameters, which will instantiate it as the current date.

Getting Properties

  • customDate.year
    returns the year defined in the customDate object
    d.year // => 2019
  • customDate.month
    returns the month defined in the customDate object
     d.month // => March
  • customDate.day
    returns the day of the month defined in the customDate object range is 0-30
     d.day // => 23
  • customDate.hour
    returns the hour defined in the customDate object
    range is 0-23
     d.hours // => 9
  • customDate.minute
    returns the minute defined in the customDate object range is 0-60
     d.minutes // => 34
  • customDate.second
    returns the second defined in the customDate object
    range is 0-60
     d.seconds // => 12

Methods

  • customDate.format(formString)
    The format method allows you to define a custom formatted output based on a few custom Characters. The characters are listed below.

    {
    'Y': 2019, // full year
    'y': 19, // shortened year
    'M': "July", // full month
    'm': "Jul", // shortened month
    'D': 01, // full day
    'd': 1, //shortened day
    'H': 05, // full hour
    'h': 5, // shortened hour
    'I': 08, // full minute
    'i': 8, //shortened minute
    'S': 04, //full second
    's': 4, //shortened second
    }
    myDate.format("M-d-Y") //=> "January-6-2019"
    myDate.format("m:d:y") //=> "Jan:6:19"
    myDate.format('Y-M-D h:I:S')) // => 2019-January-06 6:54:35

    If the format string is left empty, it will default to M/d/Y

  • customDate.when(referenceDate) The when method will return a string representaion of the difference between the reference date, and the date stored in the customDate object. The reference date defaults to the current date.

    myDate.when() // => "6 months ago"
    aDifferentDate.when() // => "4 months from now"
    b.when() // => "2 days ago"
    c.when() // => "1 year ago"