@2stefant.org/alldays 中文文档教程
alldays
alldays 计算 \ 两个 iso 工作日(1-7 表示周一到周日)\ 并返回 YYYY-MM-DD 短日历 iso 格式的字符串列表。
Technologies
包是这样写
- 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
Upgrade to newer version
的
Declare - in a javascript code file
const {alldays, dayMetrics, dayInWeek} = require("@2stefant.org/alldays");
Call
Implemented so far
:到目前为止,有 7 个已验证稳定。 \ 更高的选项尚未实现。
Detailed information
此外,alldaysVerbose 方法有助于在 \ 实施并确保正确的日期,它返回详细信息:
//alldaysVerbose()
return {
searchCriteria: string,
alldays: string[],
logs: string
};
Day metrics
dayMetrics 方法提供各种与日期相关的指标,例如:\ day, dayBefore 等
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
第一次 npm publish --access=public
下次 <代码>npm 发布
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