From 10d571fa63761fd2990081bbe9f83ddfceeb5620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Mon, 26 Jan 2015 10:47:13 +0200 Subject: [PATCH] Parse date --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 2baf5b1..d81dc39 100644 --- a/lib/index.js +++ b/lib/index.js @@ -17,7 +17,7 @@ var GitStats = module.exports = {}; * @function * @param {Object} data The commit data containing: * - * - `date` (String|Date): The date object or a string in this format: `DDD MMM dd HH:mm:ss YYYY` + * - `date` (String|Date): The date object or a string in a format that can be parsed. * - `url` (String): The repository remote url. * - `hash` (String): The commit hash. * @@ -30,7 +30,7 @@ GitStats.record = function (data, callback) { callback = callback || function (err) { if (err) throw err; }; data = Object(data); if (typeof data.date === "string") { - data.date = Moment(data.date, "DDD MMM dd HH:mm:ss yyyy"); + data.date = new Moment(new Date(data.date)); } if (!data.date || !/^Moment|Date$/.test(data.date.constructor.name)) {