diff --git a/lib/index.js b/lib/index.js index 1bf8105..3ca69ab 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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")