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

date-easy

v1.0.0

Published

A simple Node.js date management library

Downloads

1

Readme

Easy-Date: Node.js Date Management Library

Easy-Date is a straightforward Node.js date management library that provides various useful functions for handling dates effortlessly.

Installation

You can easily install Easy-Date via npm with the following command:

npm install easy-date

Usage

Adding Days to a Date
You can use the addDays function to calculate a future date by adding a specific number of days to a given date.

const easyDate = require('easy-date');
const currentDate = new Date('2023-09-24');
const futureDate = easyDate.addDays(currentDate, 7); // Add 7 days
console.log(futureDate); // Result: Date 7 days in the future


Subtracting Days from a Date
The subtractDays function allows you to calculate a past date by subtracting a specific number of days from a given date.

const easyDate = require('easy-date');
const currentDate = new Date('2023-09-24');
const pastDate = easyDate.subtractDays(currentDate, 30); // Subtract 30 days
console.log(pastDate); // Result: Date 30 days in the past


Checking Leap Years
You can use the isLeapYear function to determine whether a specific year is a leap year or not.

const easyDate = require('easy-date');
const year = 2024;
const isLeap = easyDate.isLeapYear(year);
console.log(`Is the year ${year} a leap year? ${isLeap ? 'Yes' : 'No'}`);


Calculating Age
The calculateAge function allows you to calculate a person's age based on their date of birth and a reference date.

const easyDate = require('easy-date');
const birthDate = new Date('1990-05-15');
const referenceDate = new Date(); // Current date
const age = easyDate.calculateAge(birthDate, referenceDate);
console.log(`Age: ${age.years} years, ${age.months} months, and ${age.days} days`);



Available Functions
Easy-Date offers the following functions:

getFormats(): Get all date formats for the current date.
addDays(date, days): Add a specified number of days to a date.
subtractDays(date, days): Subtract a specified number of days from a date.
isLeapYear(year): Determine if a year is a leap year.
calculateAge(birthDate, referenceDate): Calculate age based on the date of birth and a reference date.


Contributions
Contributions to Easy-Date are welcome! If you have ideas to enhance this library or encounter any issues, please don't hesitate to contribute. Here are ways you can help:

Report Issues: If you find a bug or have a suggestion, open an issue in the repository.

Submit Pull Requests: If you'd like to contribute code, you can open a pull request with your changes. Please adhere to any contribution guidelines (if provided) and include appropriate tests.

Improve Documentation: Documentation is essential. If you can improve existing documentation or add more details, it's highly appreciated.

Share the Library: If you find Easy-Date useful, please share it with other developers. The more users, the more feedback and potential contributions.

Please follow our code of conduct when contributing.

Thank you for contributing to Easy-Date!

License
This project is licensed under the MIT License - see the LICENSE file for details.

You can use this README.md as a template and customize it with specific information about your "easy-date" library, usage examples, and any additional details you'd like to provide to users.