1.9.8 • Published 3 years ago

@2stefant.org/alldays v1.9.8

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

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

1.9.8

3 years ago

1.9.1

3 years ago

1.9.0

3 years ago

1.9.4

3 years ago

1.9.3

3 years ago

1.9.2

3 years ago

1.8.6

3 years ago

1.8.5

3 years ago

1.8.2

3 years ago

1.8.1

3 years ago

1.5.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago