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

@alxrg/date-maker

v1.0.3

Published

Allows you to quickly transform the javascript date to human readable strings

Downloads

2

Readme

Date-Maker - NPM Date Library

npm

Allows you to quickly transform the javascript date to human readable strings

Installation

Use the package manager npm to install.

npm i @alxrg/date-maker

Link to npm library

Usage

const D = require("../src/index.js");
const dateTesting = new D(2022, 0, 8, 8, 4, 6);
const testDate = new D(2022, 10, 30, 6, 7, 8);
const testToday = new D();

// Full year
dateTesting.year; // 2022
// Short year
dateTesting.yr; // 22

// Full month
dateTesting.month; // 'January'
// Short month
dateTesting.mon; // 'Jan'

// Full day
dateTesting.day; // 'Saturday'
// Short day
dateTesting.dy; // 'Sat'

// Date Number
dateTesting.date; // 8

// Hour Number
dateTesting.hours; // 8
// Hour Padded (string)
dateTesting.hoursPadded; // '08'

// Minute Number
dateTesting.mins; // 4
// Minute Padded (string)
dateTesting.minsPadded; // '04'

// Second Number
dateTesting.secs; // 6
// Second Padded (string)
dateTesting.secsPadded; // '06'

// Examples of some formated dates
testDate.format("y/m/d"); // '22/Nov/Thu'
testDate.format("H:I:S"); // '06:07:08'
testDate.format("h:i:s"); // '6:7:8'
testDate.format("Y-M-D h:I:S"); // '2022-November-Thursday 6:07:08'

// Use the .when() will return the difference in time between two dates
const mockDate = new Date(2022, 10, 4);
dateTesting8.when(mockDate); // '16 days from now'
dateTesting7.when(mockDate); // '7 days ago'
dateTesting.when(mockDate); // '1 month 2 days from now'
dateTesting6.when(mockDate); // '9 months 29 days ago'
dateTesting5.when(mockDate); // '5 years 7 month 22 days from now'
dateTesting2.when(mockDate); // '12 years 10 month 3 days ago'
testToday.when(new Date()); // 'today'

Testing

The tests are running correctly = To run tests:

npm test

To check code test coverage:

npx jest --coverage

License

MIT