Show months
This commit is contained in:
parent
7c5bb1d048
commit
2ea15d18c5
16
lib/index.js
16
lib/index.js
|
@ -203,6 +203,7 @@ GitStats.ansiCalendar = function (data, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var year = []
|
var year = []
|
||||||
|
, months = []
|
||||||
, cWeek = [" ", " ", " ", " ", " ", " ", " "]
|
, cWeek = [" ", " ", " ", " ", " ", " ", " "]
|
||||||
, sDay = ""
|
, sDay = ""
|
||||||
, cDayObj = null
|
, cDayObj = null
|
||||||
|
@ -215,6 +216,12 @@ GitStats.ansiCalendar = function (data, callback) {
|
||||||
if (err) { return callback(err); }
|
if (err) { return callback(err); }
|
||||||
GitStats.iterateDays(function (cDay, mDay) {
|
GitStats.iterateDays(function (cDay, mDay) {
|
||||||
sDay = mDay.format("ddd");
|
sDay = mDay.format("ddd");
|
||||||
|
if (mDay.format("D") === "1") {
|
||||||
|
debugger
|
||||||
|
//months[mDay.format(DATE_FORMAT)] = mDay.format("MMM");
|
||||||
|
months.push(mDay.format("MMM"));
|
||||||
|
}
|
||||||
|
|
||||||
cDayObj = cal.days[cDay];
|
cDayObj = cal.days[cDay];
|
||||||
if (!cDayObj) return;
|
if (!cDayObj) return;
|
||||||
|
|
||||||
|
@ -237,11 +244,14 @@ GitStats.ansiCalendar = function (data, callback) {
|
||||||
strYear += "\n";
|
strYear += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add day names
|
||||||
strYear = strYear.split("\n").map(function (c, i) {
|
strYear = strYear.split("\n").map(function (c, i) {
|
||||||
if (i > 6) { return; }
|
if (i > 6) { return; }
|
||||||
return DAYS[i] + c;
|
return DAYS[i] + c;
|
||||||
}).join("\n");
|
}).join("\n");
|
||||||
|
|
||||||
|
var foo = "MMM"
|
||||||
|
strYear = foo + months.join(" ") + "\n" + strYear;
|
||||||
strYear +=
|
strYear +=
|
||||||
new Array(5 + 2 * Math.ceil(365 / 7)).join("-")
|
new Array(5 + 2 * Math.ceil(365 / 7)).join("-")
|
||||||
+ "\n" + "Contributions in the last year: " + cal.total
|
+ "\n" + "Contributions in the last year: " + cal.total
|
||||||
|
@ -268,8 +278,10 @@ GitStats.ansiCalendar = function (data, callback) {
|
||||||
text: strYear
|
text: strYear
|
||||||
, stretch: true
|
, stretch: true
|
||||||
, hAlign: "left"
|
, hAlign: "left"
|
||||||
});
|
}).toString();
|
||||||
|
|
||||||
callback(null, strYear.toString());
|
strYear = strYear.replace(foo, new Array(foo.length + 1).join(" "));
|
||||||
|
|
||||||
|
callback(null, strYear);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue