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

year-in-percent

v1.0.0

Published

year-in-percent is a lightweight npm package that calculates and displays the percentage of the year that has been completed.

Downloads

6

Readme

Year In Percent

NPM Version License

Year In Percent is a lightweight, easy-to-use library that provides the current year's completion percentage. It calculates the percentage of the year that has passed based on the current date and time. Perfect for adding a touch of progress tracking to your apps, websites, or projects!

Features

  • Calculate the percentage of the current year that has been completed.
  • Lightweight and easy to integrate.
  • Returns a JSON object with the percentage, current date, start of the year, end of the year, total milliseconds in the year, and milliseconds elapsed in the year.

Installation

You can install the package via npm:

npm install year-in-percent

Usage

Here's how to use the Year In Percent in your project:

import { CalculateYearCompletionPercentage } from 'year-in-percent';

// Create an instance of the calculator
const yearCompletion = new CalculateYearCompletionPercentage();

// Get the current year completion percentage
const result = yearCompletion.getYearCompletionPercentage();

console.log(result);
console.log(`Year completion: ${result.percentageCompleted}%`);

Methods

getYearCompletionPercentage()

Returns a JSON object with the following properties:

  • percentageCompleted: A string representing the percentage (e.g., "75.08").
  • now: A date object representing the current date and time.
  • startOfYear: A date object representing the start of the current year.
  • endOfYear: A date object representing the end of the current year.
  • totalMillisecondsInYear: A number representing the total milliseconds in the current year.
  • millisecondsElapsedInYear: A number representing the milliseconds elapsed since the start of the year.

Example Response:

{
    "percentageCompleted": "75.08",
    "now": "2024-10-01T18:35:52.654Z",
    "startOfYear": "2024-01-01T00:00:00.000",
    "endOfYear": "2024-12-31T23:59:59.000Z",
    "totalMillisecondsInYear": 31622399000,
    "millisecondsElapsedInYear": 23740552654
}

Setup on Your Local Machine

To set up the project on your local machine, follow these steps:

Clone the repository:

git clone [email protected]:evrentan/year-in-percent.git

Navigate to the project directory:

cd year-in-percent

Install the dependencies:

npm install

Build the project:

npm run build

Test the project:

npm test

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/yourFeature).
  3. Commit your changes (git commit -m 'feat(Feature): Add some Feature').
  4. Push to the branch (git push origin feature/yourFeature).
  5. Open a pull request.

License

This project is licensed under the ISC License.

About

This library was created to help developers easily calculate the progress of the current year. If you have any questions or suggestions, feel free to reach out!

Sponsoring

If you enjoy this project and would like to support its development, please consider sponsoring. Your support helps me continue improving and maintaining the project.

You can sponsor me via:

GitHub Sponsors

Buy Me a Coffee

Thank you for your support!