DATE_FORMAT constant. Fixed showing the latest day.

This commit is contained in:
Ionică Bizău 2015-01-30 14:55:46 +02:00
parent 0809aef044
commit aeac7d801e

View file

@ -34,6 +34,7 @@ const STORE_PATH = Ul.USER_DIR + "/.git-stats"
, "Fri"
, "Sat"
]
, DATE_FORMAT = "MMM D, YYYY"
;
// Constructor
@ -78,7 +79,7 @@ GitStats.record = function (data, callback) {
// Get stats
GitStats.get(function (err, stats) {
stats = stats || {};
var day = data.date.format("MMM D, YYYY")
var day = data.date.format(DATE_FORMAT)
, today = stats[day] = Object(stats[day])
, repo = today[data.url] = Object(today[data.url])
;
@ -113,7 +114,7 @@ GitStats.iterateDays = function (data, callback) {
data = Ul.merge({
end: Moment()
, start: Moment().subtract(1, "years")
, format: "MMM D, YYYY"
, format: DATE_FORMAT
}, data);
var start = data.start
@ -121,7 +122,7 @@ GitStats.iterateDays = function (data, callback) {
, cDay = null
;
while (!start.isAfter(end)) {
while (start.format(DATE_FORMAT) !== end.format(DATE_FORMAT)) {
cDay = start.format(data.format);
callback(cDay, start);
start.add(1, "days")