mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2025-01-03 10:22:11 +01:00
DATE_FORMAT constant. Fixed showing the latest day.
This commit is contained in:
parent
0809aef044
commit
aeac7d801e
1 changed files with 4 additions and 3 deletions
|
@ -34,6 +34,7 @@ const STORE_PATH = Ul.USER_DIR + "/.git-stats"
|
||||||
, "Fri"
|
, "Fri"
|
||||||
, "Sat"
|
, "Sat"
|
||||||
]
|
]
|
||||||
|
, DATE_FORMAT = "MMM D, YYYY"
|
||||||
;
|
;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
@ -78,7 +79,7 @@ GitStats.record = function (data, callback) {
|
||||||
// Get stats
|
// Get stats
|
||||||
GitStats.get(function (err, stats) {
|
GitStats.get(function (err, stats) {
|
||||||
stats = stats || {};
|
stats = stats || {};
|
||||||
var day = data.date.format("MMM D, YYYY")
|
var day = data.date.format(DATE_FORMAT)
|
||||||
, today = stats[day] = Object(stats[day])
|
, today = stats[day] = Object(stats[day])
|
||||||
, repo = today[data.url] = Object(today[data.url])
|
, repo = today[data.url] = Object(today[data.url])
|
||||||
;
|
;
|
||||||
|
@ -113,7 +114,7 @@ GitStats.iterateDays = function (data, callback) {
|
||||||
data = Ul.merge({
|
data = Ul.merge({
|
||||||
end: Moment()
|
end: Moment()
|
||||||
, start: Moment().subtract(1, "years")
|
, start: Moment().subtract(1, "years")
|
||||||
, format: "MMM D, YYYY"
|
, format: DATE_FORMAT
|
||||||
}, data);
|
}, data);
|
||||||
|
|
||||||
var start = data.start
|
var start = data.start
|
||||||
|
@ -121,7 +122,7 @@ GitStats.iterateDays = function (data, callback) {
|
||||||
, cDay = null
|
, cDay = null
|
||||||
;
|
;
|
||||||
|
|
||||||
while (!start.isAfter(end)) {
|
while (start.format(DATE_FORMAT) !== end.format(DATE_FORMAT)) {
|
||||||
cDay = start.format(data.format);
|
cDay = start.format(data.format);
|
||||||
callback(cDay, start);
|
callback(cDay, start);
|
||||||
start.add(1, "days")
|
start.add(1, "days")
|
||||||
|
|
Loading…
Reference in a new issue