forked from evolvingkid/weekly_commit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasklistLog.js
More file actions
35 lines (23 loc) · 1.03 KB
/
tasklistLog.js
File metadata and controls
35 lines (23 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { exec } from "child_process";
import moment from "moment";
const taskListLog = ({userEmail}) => {
let todayDate = new Date();
let startingDate = new Date();
startingDate.setDate(todayDate.getDate() - todayDate.getDay());
startingDate.setDate(startingDate.getDate() - 1);
let limitDate = new Date();
limitDate.setDate(startingDate.getDate() + 1);
while (todayDate.getDate() !== startingDate.getDate()) {
const startingDateFormat = moment(startingDate).format("YYYY-M-D");
const limitDateFormat = moment(limitDate).format("YYYY-M-D");
console.log(`Task List ${startingDateFormat} \n`);
const gitCommand = `git log --pretty=format:'%s' --author="${userEmail}" --after="${startingDateFormat}" --before="${limitDateFormat}"`;
exec(gitCommand, (err, stdout, stderr) => {
const commitMsg = stdout.split(" ").slice(1).join(" ");
console.log(commitMsg);
});
startingDate.setDate(startingDate.getDate() + 1);
limitDate.setDate(startingDate.getDate() + 1);
}
};
export default taskListLog;