From ff656150a24b37b2d7bcb97b97a437d7179d0b0f Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 3 Aug 2019 02:02:13 +0200 Subject: [PATCH] Initial commit --- .gitignore | 122 ++++++++++++++++++++++++++++++++++++++++++++++ main.js | 15 ++++++ package-lock.json | 13 +++++ package.json | 18 +++++++ 4 files changed, 168 insertions(+) create mode 100644 .gitignore create mode 100644 main.js create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..788eace --- /dev/null +++ b/.gitignore @@ -0,0 +1,122 @@ + +# Created by https://www.gitignore.io/api/code,node,vim +# Edit at https://www.gitignore.io/?templates=code,node,vim + +### Code ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# End of https://www.gitignore.io/api/code,node,vim diff --git a/main.js b/main.js new file mode 100644 index 0000000..44f455a --- /dev/null +++ b/main.js @@ -0,0 +1,15 @@ +#!/usr/bin/node + +if (!process.argv[2]) { + console.error("Missing argument: yyyy-mm-dd"); + process.exit(1); +} + +const moment = require("moment"); + +const birthday = moment(process.argv[2]); +let now = moment(); +for (let m = moment(birthday); m.isSameOrBefore(now); m.add(1, 'y')) { + const diff = m.diff(birthday, 'years'); + console.log(m.format("ddd") + ", " + m.year() + ", " + diff + " " + (diff === 1 ? "year" : "years") + " old"); +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..8cda79f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "crowl-birthdays", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "moment": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", + "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..8e68456 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "crowl-birthdays", + "version": "1.0.0", + "description": "\"Crowl\" your birthdays, see on which weekdays you had a chance to party with your friends.", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://git.banananet.work/zocker/crowl-birthdays.git" + }, + "author": "Felix Stupp", + "license": "MIT", + "dependencies": { + "moment": "^2.24.0" + } +}