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

@jewarner57/easydate

v1.1.4

Published

A compact JS date library that won't make you cry.

Downloads

3

Readme

npm (scoped) GitHub issues GitHub repo size Coveralls Travis (.com)

Easy Date

Has the default JavaScript Date object left you frustrated and sad? Then Easy Date is here to bury your sadness under another level of abstraction.

How to get started?

EasyDate Docs:

  • Below is a list of EasyDate's methods with examples and tips for using them.

when()

  • Returns a human readable string of when a date will happen in relation to the current date.
const ED = new EasyDate('April 21, 2021')

ED.when('May 20, 2021') -> "29 days from now"
ED.when('April 17, 2021') -> "4 days ago"

format()

  • Create a date format string using our list of valid format codes and send it as an argument to the format method. It will return a formatted date.
const ED = new EasyDate('March 21, 2021, 4:03')

ED.format("%M-%D-%Y") -> "03-21-2021"
ED.format('%W, %B %d, %h:%I') -> 'Sunday, March 21, 4:03'

Valid format codes and their meaning:

| Code | Meaning | |------|--------------------| | %Y | Full Year (2021) | %y | Short year (21) | %B | Full month name (August)
| %b | Abrev. month name (Aug)
| %M | Zero padding month number July: (07) | %m | Month number July: (7) | %W | Full weekday name (Monday)
| %w | Abrev. weekday name (Mon) | %a | Weekday number Sun: (0)
| %D | Zero padded day of the month (09) | %d | Day of the month (9) | %H | Zero padded hour 5pm: (05) | %h | Hour (5) | %I | Zero padded minute 5:07pm: (07) | %i | Minute 5:07pm: (7) | %S | Zero padded seconds 5:07:08pm: (08) | %s | Seconds 5:07:08pm: (8)

zeroPadNumber()

  • Takes a number the number as a string preceded with a 0 if it is less than 10.
new EasyDate().zeroPadNumber(9) -> "09"
new EasyDate().zeroPadNumber(23) -> "23"

Accessors

  • Here is a list of accessible date object properties:

| Name | Description | Example | |------|---------------------|-----------------| | year | Gets the full year | ED.year -> 2010 | | yr | Gets the short year | ED.yr -> 10 | | month| Gets the full month | ED.month -> July| | mon | Gets the short month| ED.mon -> Jul | | numMonth | Gets the month number | Ed.numMonth -> 7 | | day | Gets the full day name | Ed.day -> Tuesday | | dy | Gets the short day name | Ed.dy -> Tues | | numDay | Gets the day number| Ed.numDay -> 2 | | dom | Gets the date of the month | Ed.dom -> 6 | | hours| Gets the hour of day| Ed.hours -> 7 | | mins | Gets the current minute | Ed.mins -> 30| | secs | Gets the current second | Ed.secs -> 10|