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

@2stefant.org/alldays

v1.9.8

Published

alldays calculates all specific (e.g. sunday) days between two iso week days (1-7 means monday to sunday) and returns a list of strings in YYYY-MM-DD short calendar iso format.

Downloads

33

Readme

alldays

alldays calculates all specific (e.g. sunday) days between
two iso week days (1-7 means monday to sunday)
and returns a list of strings in YYYY-MM-DD short calendar iso format.

Technologies

This npm package is written with:

  • Visual Studio Code
  • Typescript
  • Jest, JavaScript Testing Framework with Code coverage enabled as default
  • TSLint, static analysis tool
  • Moment.js, javaScript date library for parsing, validating, manipulating and formatting dates

Usage

Install

npm install "@2stefant.org/alldays"

Upgrade to newer version

npm update "@2stefant.org/alldays"

Declare - in a javascript code file

const {alldays, dayMetrics, dayInWeek} = require("@2stefant.org/alldays");

Call

Implemented so far

In the examples below, only options 1-7 are verified stable so far.
The higher options are NOT IMPLEMENTED YET.

Detailed information

Additionally the method alldaysVerbose aids in assisting during
implementation and securing the correct days, it returns detailed information:

//alldaysVerbose()
return {
    searchCriteria: string,
    alldays: string[],
    logs: string
};

Day metrics

The method dayMetrics provides various Day related metrics such as:
day, dayBefore etc.

return dayMetrics("2020-11-22");

// Other useful methods:
console.log(dayInWeek"2020-11-22",1)); // 2020-11-16, monday.
console.log(dayInWeek"2020-11-22",5)); // 2020-11-20, friday.

weekDaysShort();
monthsShort();
calendarMetrics();
calendarBoundary();

Zero or one argument, index range 1-7, 10-17, 20-27

let days=alldays(); //No args = 7 = sundays current whole year.
console.log(JSON.stringify(days));

days=alldays(4); //4 = thursdays current whole year.
console.log(JSON.stringify(days));

days=alldays(17); //17 = sundays current year until current week.
console.log(JSON.stringify(days));

days=alldays(26); //26 = saturdays current year until current month.
console.log(JSON.stringify(days));

From specific date

days=alldays(2, "2020-10-01"); //2 = tuesdays current whole year.
console.log(JSON.stringify(days));

days=alldays(20, "2020-10-01"); //2 = tuesdays until current month.
console.log(JSON.stringify(days));

Specific date range

days=alldays(15, "2020-10-01", "2020-12-01"); //5 = fridays until current week.
console.log(JSON.stringify(days));

How to update an npm package

Update version in the package.json file

  "version": "1.X.0",

Commit changes to github repo

Open npm prompt, perform login to npm (add username, password and email)

npm adduser

Publish package

First time npm publish --access=public

Next time npm publish