mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-12-22 13:22:11 +01:00
Fixed #45. Show the time range in the box
This commit is contained in:
parent
02589714c9
commit
5ccd909b2a
1 changed files with 11 additions and 1 deletions
12
lib/index.js
12
lib/index.js
|
@ -3,6 +3,7 @@ var Ul = require("ul")
|
|||
, Fs = require("fs")
|
||||
, Moment = require("moment")
|
||||
, CliBox = require("cli-box")
|
||||
, Couleurs = require("couleurs")()
|
||||
;
|
||||
|
||||
// Constants
|
||||
|
@ -296,12 +297,21 @@ GitStats.ansiCalendar = function (data, callback) {
|
|||
, strMonths = ""
|
||||
, w = 0
|
||||
, d = 0
|
||||
, when = "the last year"
|
||||
, dataClone = {
|
||||
start: data.start ? Moment(data.start.format(DATE_FORMAT), DATE_FORMAT) : null
|
||||
, end: data.end ? Moment(data.end.format(DATE_FORMAT), DATE_FORMAT) : null
|
||||
}
|
||||
;
|
||||
|
||||
dataClone.s = data.start.format(DATE_FORMAT);
|
||||
dataClone.e = data.end.format(DATE_FORMAT);
|
||||
|
||||
if (Moment().subtract(1, "years").format(DATE_FORMAT) !== dataClone.s
|
||||
|| Moment().format(DATE_FORMAT) !== dataClone.e) {
|
||||
when = [Couleurs.bold(dataClone.s), Couleurs.bold(dataClone.e)].join(" – ");
|
||||
}
|
||||
|
||||
GitStats.calendar(data, function (err, cal) {
|
||||
if (err) { return callback(err); }
|
||||
GitStats.iterateDays(dataClone, function (cDay, mDay) {
|
||||
|
@ -355,7 +365,7 @@ GitStats.ansiCalendar = function (data, callback) {
|
|||
strYear = monthHack + strMonths + "\n" + strYear;
|
||||
strYear +=
|
||||
new Array(5 + 2 * Math.ceil(365 / 7)).join("-")
|
||||
+ "\n" + "Contributions in the last year: " + cal.total
|
||||
+ "\n" + "Commits in " + when + ": " + cal.total
|
||||
+ " | " + "Longest Streak: " + cal.lStreak + " days"
|
||||
+ " | " + "Current Streak: " + cal.cStreak + " days"
|
||||
+ " | " + "Max a day: " + cal.max
|
||||
|
|
Loading…
Reference in a new issue