From 7ffe5badc7fce04eb132b8e4d21bfaf3eefd9c37 Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Tue, 31 May 2022 06:39:27 +0200 Subject: [PATCH] feat(ary-this-week): initial commit --- ary-this-week/.gitignore | 1 + ary-this-week/README.md | 21 +++++++++++++++++++++ ary-this-week/ary-this-week.js | 13 +++++++++++++ ary-this-week/index.js | 15 +++++++++++++++ ary-this-week/package.json | 16 ++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 ary-this-week/.gitignore create mode 100644 ary-this-week/README.md create mode 100644 ary-this-week/ary-this-week.js create mode 100644 ary-this-week/index.js create mode 100644 ary-this-week/package.json diff --git a/ary-this-week/.gitignore b/ary-this-week/.gitignore new file mode 100644 index 0000000..e6905a2 --- /dev/null +++ b/ary-this-week/.gitignore @@ -0,0 +1 @@ +.env* \ No newline at end of file diff --git a/ary-this-week/README.md b/ary-this-week/README.md new file mode 100644 index 0000000..b34d55d --- /dev/null +++ b/ary-this-week/README.md @@ -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 diff --git a/ary-this-week/ary-this-week.js b/ary-this-week/ary-this-week.js new file mode 100644 index 0000000..a833afa --- /dev/null +++ b/ary-this-week/ary-this-week.js @@ -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 +}; diff --git a/ary-this-week/index.js b/ary-this-week/index.js new file mode 100644 index 0000000..d30e271 --- /dev/null +++ b/ary-this-week/index.js @@ -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.') +} diff --git a/ary-this-week/package.json b/ary-this-week/package.json new file mode 100644 index 0000000..f1c966d --- /dev/null +++ b/ary-this-week/package.json @@ -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" + } +}