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

panda-ate

v1.0.2

Published

A date util package

Downloads

2

Readme

Panda-ate: A Date Util Package

This is an lightweight package that provides a convenient way to work with dates in JavaScript. With this package, you can easily perform various date operations such as getting the current date, calculating dates for yesterday, tomorrow, last week, next week, or parsing dates from the "YYYY-MM-DD" format.

Installation

You can install this package using npm by running the following command:

npm i panda-ate

Usage

To use this package in your JavaScript project, require/import it as follows:
const { giveDate } = require('panda-ate');

Example Usage

Here are some examples of how to use the giveDate function:

const today = giveDate('today');
console.log(today);
// Output: Current date (e.g., '2023-05-20')

const yesterday = giveDate('yesterday');
console.log(yesterday);
// Output: Date of yesterday (e.g., '2023-05-19')

const tomorrow = giveDate('tomorrow');
console.log(tomorrow);
// Output: Date of tomorrow (e.g., '2023-05-21')

const lastWeek = giveDate('last week');
console.log(lastWeek);
// Output: Date of last week (e.g., '2023-05-13')

const nextWeek = giveDate('next week');
console.log(nextWeek);
// Output: Date of next week (e.g., '2023-05-27')

const lastSunday = giveDate('last sunday');
console.log(lastSunday);
// Output: Date of last Sunday (e.g., '2023-05-14')

const nextMonday = giveDate('next monday');
console.log(nextMonday);
// Output: Date of next Monday (e.g., '2023-05-22')

const customDate = giveDate('2023-05-18');
console.log(customDate);
// Output: Date parsed from "YYYY-MM-DD" format (e.g., '2023-05-18')

API

giveDate(dateSpecifier)

This function takes a dateSpecifier parameter and returns a date based on the specifier provided. The supported specifiers are:

'today': Returns the current date.  
'yesterday': Returns the date of yesterday.  
'tomorrow': Returns the date of tomorrow.  
'last week': Returns the date of last week.  
'next week': Returns the date of next week.  
'last sunday': Returns the date of the most recent Sunday.  
'next monday': Returns the date of the upcoming Monday.  
'YYYY-MM-DD': Parses the date from the provided format and returns it.  

Contributing

Contributions are welcome! If you encounter any issues, have suggestions, or would like to add new features, please open an issue or submit a pull request on the GitHub repository.

License

This package is distributed under the MIT License.