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.
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
npm install "@2stefant.org/alldays"
npm update "@2stefant.org/alldays"
const {alldays, dayMetrics, dayInWeek} = require("@2stefant.org/alldays");
In the examples below, only options 1-7 are verified stable so far.
The higher options are NOT IMPLEMENTED YET.
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
};
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();
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));
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));
days=alldays(15, "2020-10-01", "2020-12-01"); //5 = fridays until current week.
console.log(JSON.stringify(days));
"version": "1.X.0",
npm adduser
First time
npm publish --access=public
Next time
npm publish