feat(ary-this-week): initial commit
This commit is contained in:
parent
e4a25a851a
commit
7ffe5badc7
|
@ -0,0 +1 @@
|
||||||
|
.env*
|
|
@ -0,0 +1,21 @@
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
tbc
|
||||||
|
|
||||||
|
## Preparation
|
||||||
|
Run the following command in your favorite terminal to install dependenies.
|
||||||
|
```
|
||||||
|
npm i
|
||||||
|
```
|
||||||
|
## Development setup
|
||||||
|
Run the following command in your favorite terminal if you fancy log messages for debugging.
|
||||||
|
```
|
||||||
|
export DEBUG=$DEBUG,debug,ary-this-week
|
||||||
|
```
|
||||||
|
Run the following command in your favorite terminal to start the service in development mode.
|
||||||
|
```
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
## Production deployment
|
||||||
|
|
||||||
|
tbc
|
|
@ -0,0 +1,13 @@
|
||||||
|
function getAryThisWeek(date){
|
||||||
|
const dateToday=new Date();
|
||||||
|
let dateIncrement=new Date(dateToday);
|
||||||
|
aryThisWeek=[];
|
||||||
|
for(var i=0;i<7;i++){
|
||||||
|
aryThisWeek[i]=new Date(dateIncrement);
|
||||||
|
dateIncrement=new Date(dateIncrement.setDate(dateIncrement.getDate()+1));
|
||||||
|
}
|
||||||
|
return aryThisWeek;
|
||||||
|
}
|
||||||
|
module.exports={
|
||||||
|
getAryThisWeek
|
||||||
|
};
|
|
@ -0,0 +1,15 @@
|
||||||
|
const Debug=require('debug')('debug');
|
||||||
|
const AryThisWeek=require('./ary-this-week');
|
||||||
|
|
||||||
|
run().catch(err => {
|
||||||
|
Debug('run: error')
|
||||||
|
console.log(err)
|
||||||
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
Debug('run started...')
|
||||||
|
const thisWeek=AryThisWeek.getAryThisWeek(new Date());
|
||||||
|
|
||||||
|
Debug('thisWeek: '+thisWeek)
|
||||||
|
Debug('run done.')
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"private": "true",
|
||||||
|
"name": "ary-this-week",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "nodemon index.js",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "Stefan Begerad",
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"nodemon": "^2.0.7"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue